Part Number Hot Search : 
UCC20225 2SC4793 T1206 25Q40 BP104S 015EZ0 1N599 D74ALVC1
Product Description
Full Text Search
 

To Download S3C2440 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  S3C2440a 32-bit cmos microcontroller user's manual revision 1
important notice the information in this publication has been carefully checked and is believed to be entirely accurate at the time of publication. samsung assumes no responsibility, however, for possible errors or omissions, or for any consequences resulting from the use of the information contained herein. samsung reserves the right to make changes in its products or product specifications with the intent to improve function or design at any time and without notice and is not required to update this documentation to reflect such changes. this publication does not convey to a purchaser of semiconductor devices described herein any license under the patent rights of samsung or others. samsung makes no warranty, representation, or guarantee regarding the suitability of its products for any particular purpose, nor does samsung assume any liability arising out of the application or use of any product or circuit and specifically disclaims any and all liability, including without limitation any consequential or incidental damages. "typical" parameters can and do vary in different applications. all operating parameters, including "typicals" must be validated for each customer application by the customer's technical experts. samsung products are not designed, intended, or authorized for use as components in systems intended for surgical implant into the body, for other applications intended to support or sustain life, or for any other application in which the failure of the samsung product could create a situation where personal injury or death may occur. should the buyer purchase or use a samsung product for any such unintended or unauthorized application, the buyer shall indemnify and hold samsung and its officers, employees, subsidiaries, affiliates, and distributors harmless against all claims, costs, damages, expenses, and reasonable attorney fees arising out of, either directly or indirectly, any claim of personal injury or death that may be associated with such unintended or unauthorized use, even if such claim alleges that samsung was negligent regarding the design or manufacture of said product. S3C2440a 32-bit cmos microcontroller user's manual, revision 1 publication number: 21-s3-c2440a-072004 ? 2004 samsung electronics all rights reserved. no part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, electric or mechanical, by photocopying, recording, or otherwise, without the prior written consent of samsung electronics. samsung electronics' microcontroller business has been awarded full iso-14001 certification (bvq1 certificate no. 9330). all semiconductor products are designed and manufactured in accordance with the highest quality standards and objectives. samsung electronics co., ltd. san #24 nongseo-ri, giheung- eup yongin-city, gyeonggi-do, korea c.p.o. box #37, suwon 449-900 tel: (82)-(031)-209-1490 fax: (82) (331) 209-1909 home-page url: http://www.samsungsemi.com/ printed in the republic of korea
S3C2440a microcontroller iii table of contents chapter 1 product overview introduction ................................ ................................ ................................ ................................ ......... 1-1 features ................................ ................................ ................................ ................................ ............. 1-2 block diagram ................................ ................................ ................................ ................................ .... 1-5 pin assignments ................................ ................................ ................................ ................................ . 1-6 signal descriptions ................................ ................................ ................................ .............................. 1-20 S3C2440a special registers ................................ ................................ ................................ ................ 1-26 chapter 2 programmer's model overview ................................ ................................ ................................ ................................ ............. 2-1 processor operating states ................................ ................................ ................................ ......... 2-1 switching state ................................ ................................ ................................ ........................... 2-1 memory formats ................................ ................................ ................................ ......................... 2-1 big-endian format ................................ ................................ ................................ ....................... 2-2 little-endian format ................................ ................................ ................................ .................... 2-2 instruction length ................................ ................................ ................................ ........................ 2-2 operating modes ................................ ................................ ................................ ......................... 2-3 registers ................................ ................................ ................................ ................................ .... 2-3 the program status registers ................................ ................................ ................................ ...... 2-7 exceptions ................................ ................................ ................................ ................................ . 2-10 interrupt latencies ................................ ................................ ................................ ....................... 2-15 reset ................................ ................................ ................................ ................................ ......... 2-15
iv S3C2440a microcontroller table of contents (continued) chapter 3 arm instruction set instruction set summay ................................ ................................ ................................ ....................... 3-1 format summary ................................ ................................ ................................ ........................ 3-1 instruction summary ................................ ................................ ................................ .................... 3-2 the condition field ................................ ................................ ................................ .............................. 3-4 branch and exchange (bx) ................................ ................................ ................................ ................... 3-5 instruction cycle times ................................ ................................ ................................ ................ 3-5 assembler syntax ................................ ................................ ................................ ....................... 3-5 using r15 as an operand ................................ ................................ ................................ ............ 3-5 branch and branch with link (b, bl) ................................ ................................ ................................ ...... 3-7 the link bit ................................ ................................ ................................ ................................ 3-7 instruction cycle times ................................ ................................ ................................ ................ 3-7 assembler syntax ................................ ................................ ................................ ....................... 3-8 data processing ................................ ................................ ................................ ................................ .. 3-9 cpsr flags ................................ ................................ ................................ ................................ .. 3-11 shifts ................................ ................................ ................................ ................................ ......... 3-12 immediate operand rotates ................................ ................................ ................................ ......... 3-16 writing to r15 ................................ ................................ ................................ ............................. 3-16 using r15 as an operandy ................................ ................................ ................................ ........... 3-16 teq, tst, cmp and cmn opcodes ................................ ................................ ............................... 3-16 instruction cycle times ................................ ................................ ................................ ................ 3-16 assembler syntax ................................ ................................ ................................ ....................... 3-17 examples ................................ ................................ ................................ ................................ ... 3-17 psr transfer (mrs, msr) ................................ ................................ ................................ ..................... 3-18 operand restrictions ................................ ................................ ................................ ................... 3-18 reserved bits ................................ ................................ ................................ .............................. 3-20 examples ................................ ................................ ................................ ................................ ... 3-20 instruction cycle times ................................ ................................ ................................ ................ 3-20 assembly syntax ................................ ................................ ................................ ........................ 3-21 examples ................................ ................................ ................................ ................................ ... 3-21 multiply and multiply-accumulate (mul, mla) ................................ ................................ ....................... 3-22 cpsr flags ................................ ................................ ................................ ................................ .. 3-24 instruction cycle times ................................ ................................ ................................ ................ 3-24 assembler syntax ................................ ................................ ................................ ....................... 3-24 examples ................................ ................................ ................................ ................................ ... 3-24 multiply long and multiply-accumulate long (mull, mlal) ................................ ................................ ... 3-25 operand restrictions ................................ ................................ ................................ ................... 3-26 cpsr flags ................................ ................................ ................................ ................................ .. 3-26 instruction cycle times ................................ ................................ ................................ ................ 3-26 assembler syntax ................................ ................................ ................................ ....................... 3-27 examples ................................ ................................ ................................ ................................ ... 3-27
S3C2440a microcontroller v table of contents (continued) chapter 3 arm instruction set (continued) single data transfer (ldr, str) ................................ ................................ ................................ ........... 3-28 offsets and auto-indexing ................................ ................................ ................................ ............ 3-29 shifted register offset ................................ ................................ ................................ ................. 3-29 bytes and words ................................ ................................ ................................ ........................ 3-29 use of r15 ................................ ................................ ................................ ................................ .. 3-31 example ................................ ................................ ................................ ................................ ..... 3-31 data aborts ................................ ................................ ................................ ................................ 3-31 instruction cycle times ................................ ................................ ................................ ................ 3-31 assembler syntax ................................ ................................ ................................ ....................... 3-32 examples ................................ ................................ ................................ ................................ ... 3-33 halfword and signed data transfer (ldrh/strh/ldrsb/ldrsh) ................................ ........................... 3-34 offsets and auto-indexing ................................ ................................ ................................ ............ 3-35 halfword load and stores ................................ ................................ ................................ ............. 3-36 use of r15 ................................ ................................ ................................ ................................ .. 3-37 data aborts ................................ ................................ ................................ ................................ 3-37 instruction cycle times ................................ ................................ ................................ ................ 3-37 assembler syntax ................................ ................................ ................................ ....................... 3-38 examples ................................ ................................ ................................ ................................ ... 3-39 block data transfer (ldm, stm) ................................ ................................ ................................ ........... 3-40 the register list ................................ ................................ ................................ ......................... 3-40 addressing modes ................................ ................................ ................................ ....................... 3-41 address alignment ................................ ................................ ................................ ...................... 3-41 use of the s bit ................................ ................................ ................................ ........................... 3-43 use of r15 as the base ................................ ................................ ................................ .............. 3-43 inclusion of the base in the register list ................................ ................................ ....................... 3-44 data aborts ................................ ................................ ................................ ................................ 3-44 instruction cycle times ................................ ................................ ................................ ................ 3-44 assembler syntax ................................ ................................ ................................ ....................... 3-45 examples ................................ ................................ ................................ ................................ ... 3-46 single data swap (swp) ................................ ................................ ................................ ..................... 3-47 bytes and words ................................ ................................ ................................ ........................ 3-47 use of r15 ................................ ................................ ................................ ................................ .. 3-48 data aborts ................................ ................................ ................................ ................................ 3-48 instruction cycle times ................................ ................................ ................................ ................ 3-48 assembler syntax ................................ ................................ ................................ ....................... 3-48 software interrupt (swi) ................................ ................................ ................................ ....................... 3-49 return from the supervisor ................................ ................................ ................................ ........... 3-49 comment field ................................ ................................ ................................ ............................ 3-49 instruction cycle times ................................ ................................ ................................ ................ 3-49 assembler syntax ................................ ................................ ................................ ....................... 3-50 coprocessor data operations (cdp) ................................ ................................ ................................ ..... 3-51 coprocessor instructions ................................ ................................ ................................ .............. 3-51 instruction cycle times ................................ ................................ ................................ ................ 3-52 examples ................................ ................................ ................................ ................................ ... 3-52
vi S3C2440a microcontroller table of contents (continued) chapter 3 arm instruction set (continued) coprocessor data transfers (ldc, stc) ................................ ................................ ................................ 3-53 the coprocessor fields ................................ ................................ ................................ ............... 3-54 addressing modes ................................ ................................ ................................ ....................... 3-54 address alignment ................................ ................................ ................................ ...................... 3-54 data aborts ................................ ................................ ................................ ................................ 3-54 assembler syntax ................................ ................................ ................................ ....................... 3-55 examples ................................ ................................ ................................ ................................ ... 3-55 coprocessor register transfers (mrc, mcr) ................................ ................................ ................. 3-56 the coprocessor fields ................................ ................................ ................................ ............... 3-56 transfers to r15 ................................ ................................ ................................ .......................... 3-57 transfers from r15 ................................ ................................ ................................ ...................... 3-57 instruction cycle times ................................ ................................ ................................ ................ 3-57 assembler syntax ................................ ................................ ................................ ....................... 3-57 examples ................................ ................................ ................................ ................................ ... 3-57 undefined instruction ................................ ................................ ................................ ................... 3-58 instruction cycle times ................................ ................................ ................................ ................ 3-58 assembler syntax ................................ ................................ ................................ ....................... 3-58 instruction set examples ................................ ................................ ................................ ............. 3-59 using the conditional instructions ................................ ................................ ................................ . 3-59 pseudo-random binary sequence generator ................................ ................................ ................. 3-61 multiplication by constant using the barrel shifter ................................ ................................ .......... 3-61 loading a word from an unknown alignment ................................ ................................ ................. 3-63 chapter 4 thumb instruction set thumb instruction set format ................................ ................................ ................................ ............... 4-1 format summary ................................ ................................ ................................ ........................ 4-2 opcode summary ................................ ................................ ................................ ....................... 4-3 format 1: move shifted register ................................ ................................ ................................ ........... 4-5 operation ................................ ................................ ................................ ................................ .... 4-5 instruction cycle times ................................ ................................ ................................ ................ 4-6 examples ................................ ................................ ................................ ................................ ... 4-6 format 2: add/subtract ................................ ................................ ................................ ........................ 4-7 operation ................................ ................................ ................................ ................................ .... 4-7 instruction cycle times ................................ ................................ ................................ ................ 4-8 examples ................................ ................................ ................................ ................................ ... 4-8 format 3: move/compare/add/subtract immediate ................................ ................................ ................. 4-9 operations ................................ ................................ ................................ ................................ .. 4-9 instruction cycle times ................................ ................................ ................................ ................ 4-10 examples ................................ ................................ ................................ ................................ ... 4-10
S3C2440a microcontroller vii table of contents (continued) chapter 4 thumb instruction set (continued) format 4: alu operations ................................ ................................ ................................ .................... 4-11 operation ................................ ................................ ................................ ................................ .... 4-11 instruction cycle times ................................ ................................ ................................ ................ 4-12 examples ................................ ................................ ................................ ................................ ... 4-12 format 5: hi-register operations/branch exchange ................................ ................................ ............... 4-13 operation ................................ ................................ ................................ ................................ .... 4-13 instruction cycle times ................................ ................................ ................................ ................ 4-14 the bx instruction ................................ ................................ ................................ ....................... 4-14 examples ................................ ................................ ................................ ................................ ... 4-15 using r15 as an operand ................................ ................................ ................................ ............ 4-15 format 6: pc-relative load ................................ ................................ ................................ .................. 4-16 operation ................................ ................................ ................................ ................................ .... 4-16 instruction cycle times ................................ ................................ ................................ ................ 4-17 examples ................................ ................................ ................................ ................................ ... 4-17 format 7: load/store with register offset ................................ ................................ ............................. 4-18 operation ................................ ................................ ................................ ................................ .... 4-19 instruction cycle times ................................ ................................ ................................ ................ 4 -19 examples ................................ ................................ ................................ ................................ ... 4-19 format 8: load/store sign-extended byte/halfword ................................ ................................ ................ 4-20 operation ................................ ................................ ................................ ................................ .... 4-20 instruction cycle times ................................ ................................ ................................ ................ 4-21 examples ................................ ................................ ................................ ................................ ... 4-21 format 9: load/store with immediate offset ................................ ................................ .......................... 4-22 operation ................................ ................................ ................................ ................................ .... 4-23 instruction cycle times ................................ ................................ ................................ ................ 4-23 examples ................................ ................................ ................................ ................................ ... 4-23 format 10: load/store halfword ................................ ................................ ................................ ............ 4-24 operation ................................ ................................ ................................ ................................ .... 4-24 examples ................................ ................................ ................................ ................................ ... 4-25 format 11: sp-relative load/store ................................ ................................ ................................ ....... 4-26 operation ................................ ................................ ................................ ................................ .... 4-26 instruction cycle times ................................ ................................ ................................ ................ 4-27 examples ................................ ................................ ................................ ................................ ... 4-27 format 12: load address ................................ ................................ ................................ ..................... 4-28 operation ................................ ................................ ................................ ................................ .... 4-28 instruction cycle times ................................ ................................ ................................ ................ 4-29 examples ................................ ................................ ................................ ................................ ... 4-29 format 13: add offset to stack pointer ................................ ................................ ................................ . 4-30 operation ................................ ................................ ................................ ................................ .... 4-30 instruction cycle times ................................ ................................ ................................ ................ 4-30 examples ................................ ................................ ................................ ................................ ... 4-30
viii S3C2440a microcontroller table of contents (continued) chapter 4 thumb instruction set (continued) format 14: push/pop registers ................................ ................................ ................................ ............ 4-31 operation ................................ ................................ ................................ ................................ .... 4-31 instruction cycle times ................................ ................................ ................................ ................ 4-32 examples ................................ ................................ ................................ ................................ ... 4-32 format 15: multiple load/store ................................ ................................ ................................ ............. 4-33 operation ................................ ................................ ................................ ................................ .... 4-33 instruction cycle times ................................ ................................ ................................ ................ 4-33 examples ................................ ................................ ................................ ................................ ... 4-33 format 16: conditional branch ................................ ................................ ................................ .............. 4-34 operation ................................ ................................ ................................ ................................ .... 4-34 instruction cycle times ................................ ................................ ................................ ................ 4-35 examples ................................ ................................ ................................ ................................ ... 4-35 format 17: software interrupt ................................ ................................ ................................ ................ 4-36 operation ................................ ................................ ................................ ................................ .... 4-36 instruction cycle times ................................ ................................ ................................ ................ 4-36 examples ................................ ................................ ................................ ................................ ... 4-36 format 18: unconditional branch ................................ ................................ ................................ .......... 4-37 operation ................................ ................................ ................................ ................................ .... 4-37 examples ................................ ................................ ................................ ................................ ... 4-37 format 19: long branch with link ................................ ................................ ................................ ........... 4-38 operation ................................ ................................ ................................ ................................ .... 4-38 instruction cycle times ................................ ................................ ................................ ................ 4-39 examples ................................ ................................ ................................ ................................ ... 4-39 instruction set examples ................................ ................................ ................................ ..................... 4-40 multiplication by a constant using shifts and adds ................................ ................................ ........ 4-40 general purpose signed divide ................................ ................................ ................................ ..... 4-41 division by a constant ................................ ................................ ................................ ................. 4-43
S3C2440a microcontroller ix table of contents (continued) chapter 5 memory controller overview ................................ ................................ ................................ ................................ ............. 5-1 function description ................................ ................................ ................................ ............................ 5-4 bank0 bus width ................................ ................................ ................................ ........................ 5-4 memory (srom/sdram) address pin connections ................................ ................................ ....... 5-4 sdram bank address pin connection example ................................ ................................ .............. 5-5 nwait pin operation ................................ ................................ ................................ ................... 5-6 nxbreq/nxback pin operation ................................ ................................ ................................ ... 5-7 programmable access cycle ................................ ................................ ................................ ....... 5-12 bus width & wait control register (bwscon) ................................ ................................ ................. 5-14 bank control register (bankconn: ngcs0-ngcs5) ................................ ................................ ....... 5-16 bank control register (bankconn: ngcs6-ngcs7) ................................ ................................ ....... 5-17 refresh control register ................................ ................................ ................................ .............. 5-18 banksize register ................................ ................................ ................................ ....................... 5-19 sdram mode register set register (mrsr) ................................ ................................ ................... 5-20 chapter 6 nand flash contorller overview ................................ ................................ ................................ ................................ ............. 6-1 features ................................ ................................ ................................ ................................ ..... 6-1 block diagram ................................ ................................ ................................ ............................ 6-2 boot loader function ................................ ................................ ................................ ................... 6-2 pin configuration ................................ ................................ ................................ ......................... 6-3 nand flash memory configuration table ................................ ................................ ........................ 6-3 nand flash memory timing ................................ ................................ ................................ .......... 6-4 software mode ................................ ................................ ................................ ................................ .... 6-5 steppingstone (4k-byte sram) ................................ ................................ ................................ .... 6-6 ecc (error correction code) ................................ ................................ ................................ .................. 6-7 2048 byte ecc parity code assignment table ................................ ................................ .............. 6-7 16 byte ecc parity code assignment table ................................ ................................ .................. 6-7 ecc module features ................................ ................................ ................................ .................. 6-8 ecc programming guide ................................ ................................ ................................ ............. 6-8 nand flash memory mapping ................................ ................................ ................................ ....... 6-9 nand flash memory configuration ................................ ................................ ................................ . 6-10 nand flash configuration register ................................ ................................ ................................ 6-12 control register ................................ ................................ ................................ .......................... 6-13 command register ................................ ................................ ................................ ...................... 6-15 address register ................................ ................................ ................................ ......................... 6-15 data register ................................ ................................ ................................ .............................. 6-15 main data area register ................................ ................................ ................................ .............. 6-16 spare area ecc register ................................ ................................ ................................ ............. 6-17 nfcon status register ................................ ................................ ................................ ............... 6-18 ecc0/1 status register ................................ ................................ ................................ ............... 6-19 main data area ecc0 status register ................................ ................................ .......................... 6-20 spare area ecc status register ................................ ................................ ................................ .. 6-20 block address register ................................ ................................ ................................ ............... 6-21
x S3C2440a microcontroller table of contents (continued) chapter 7 clock & power management overview ................................ ................................ ................................ ................................ ............. 7-1 functional description ................................ ................................ ................................ ......................... 7-2 clock architecture ................................ ................................ ................................ ....................... 7-2 clock source selection ................................ ................................ ................................ ................ 7-2 phase locked loop (pll) ................................ ................................ ................................ ............ 7-4 clock control logic ................................ ................................ ................................ ..................... 7-6 power management ................................ ................................ ................................ ..................... 7-10 clock generator & power management special register ................................ ................................ ........ 7-20 lock time count register (locktime) ................................ ................................ ......................... 7-20 pll control register (mpllcon & upllcon) ................................ ................................ .............. 7-21 pll value selection table ................................ ................................ ................................ ........... 7-21 clock control register (clkcon) ................................ ................................ ................................ . 7-22 clock slow control (clkslow) register ................................ ................................ ...................... 7-23 clock divider control (clkdivn) register ................................ ................................ ...................... 7-24 camera clock divider (camdivn) register ................................ ................................ .................... 7-25 chapter 8 dma overview ................................ ................................ ................................ ................................ ............. 8-1 dma request sources ................................ ................................ ................................ ........................ 8-2 dma operation ................................ ................................ ................................ ................................ ... 8-2 external dma dreq/dack protocol ................................ ................................ ............................ 8-3 examples ................................ ................................ ................................ ................................ ........... 8-6 dma special registers ................................ ................................ ................................ ........................ 8-7 dma initial source (disrc) register ................................ ................................ ............................. 8-7 dma initial source control (disrcc) register ................................ ................................ ............... 8-7 dma initial destination (didst) register ................................ ................................ ....................... 8-8 dma initial destination control (didstc) register ................................ ................................ .......... 8-8 dma control (dcon) register ................................ ................................ ................................ ...... 8-9 dma status (dstat) register ................................ ................................ ................................ ...... 8-12 dma current source (dcsrc) register ................................ ................................ ........................ 8-13 current destination (dcdst) register ................................ ................................ ........................... 8-13 dma mask trigger (dmasktrig) register ................................ ................................ .................... 8-14
S3C2440a microcontroller xi table of contents (continued) chapter 9 i/o ports overview ................................ ................................ ................................ ................................ ............. 9-1 port control descriptions ................................ ................................ ................................ ..................... 9-7 port configuration register (gpacon-gpjcon) ................................ ................................ ............ 9-7 port data register (gpadat-gpjdat) ................................ ................................ ......................... 9-7 port pull-up register (gpbup-gpjup) ................................ ................................ ......................... 9-7 miscellaneous control register ................................ ................................ ................................ ..... 9-7 external interrupt control register ................................ ................................ ................................ . 9-7 i/o port control register ................................ ................................ ................................ ...................... 9-8 port a control registers (gpacon, gpadat) ................................ ................................ .............. 9-8 port b control registers (gpbcon, gpbdat, gpbup) ................................ ................................ . 9-10 port c control registers (gpccon, gpcdat, gpcup) ................................ ................................ . 9-11 port d control registers (gpdcon, gpddat, gpdup) ................................ ................................ . 9-13 port e control registers (gpecon, gpedat, gpeup) ................................ ................................ . 9-15 port f control registers (gpfcon, gpfdat) ................................ ................................ ............... 9-17 port g control registers (gpgcon, gpgdat) ................................ ................................ ............. 9-18 port h control registers (gphcon, gphdat) ................................ ................................ .............. 9-20 port j control registers (gpjcon, gpjdat) ................................ ................................ ................ 9-21 miscellaneous control register (misccr) ................................ ................................ ..................... 9-23 dclk control registers (dclkcon) ................................ ................................ ............................. 9-25 extintn (external interrupt control register n) ................................ ................................ ............... 9-26 eintfltn (external interrupt filter register n) ................................ ................................ ................ 9-30 eintmask (external interrupt mask register) ................................ ................................ ............... 9-31 eintpend (external interrupt pending register) ................................ ................................ ............ 9-32 gstatusn (general status registers) ................................ ................................ ......................... 9-33 dscn (drive strength control) ................................ ................................ ................................ ....... 9-34 dscn (drive strength control) ................................ ................................ ................................ ....... 9-35 mslcon (memory sleep control register) ................................ ................................ .................... 9-36
xii S3C2440a microcontroller table of contents (continued) chapter 10 basic timer overview ................................ ................................ ................................ ................................ ............. 10-1 feature ................................ ................................ ................................ ................................ ....... 10-1 pwm timer operation ................................ ................................ ................................ ......................... 10-3 prescaler & divider ................................ ................................ ................................ ...................... 10-3 basic timer operation ................................ ................................ ................................ ................. 10-3 auto reload & double buffering ................................ ................................ ................................ .... 10-4 timer initialization using manual update bit and inverter bit ................................ ............................ 10-5 timer operation ................................ ................................ ................................ ........................... 10-6 pulse width modulation (pwm) ................................ ................................ ................................ .... 10-7 output level control ................................ ................................ ................................ .................... 10-8 dead zone generator ................................ ................................ ................................ ................... 10-9 dma request mode ................................ ................................ ................................ .................... 10-10 pwm timer control registers ................................ ................................ ................................ .............. 10-11 timer configuration register0 (tcfg0) ................................ ................................ .......................... 10-11 timer configuration register1 (tcfg1) ................................ ................................ .......................... 10-12 timer control (tcon) register ................................ ................................ ................................ ...... 10-13 timer 0 count buffer register & compare buffer register (tcntb0/tcmpb0) ................................ ... 10-15 timer 0 count observation register (tcnto0) ................................ ................................ ............... 10-15 timer 1 count buffer register & compare buffer register (tcntb1/tcmpb1) ................................ ... 10-16 timer 1 count observation register (tcnto1) ................................ ................................ ............... 10-16 timer 2 count buffer register & compare buffer register (tcntb2/tcmpb2) ................................ ... 10-17 timer 2 count observation register (tcnto2) ................................ ................................ ............... 10-17 timer 3 count buffer register & compare buffer register (tcntb3/tcmpb3) ................................ ... 10-18 timer 3 count observation register (tcnto3) ................................ ................................ ............... 10-18 timer 4 count buffer register (tcntb4) ................................ ................................ ........................ 10-19 timer 4 count observation register (tcnto4) ................................ ................................ ............... 10-19
S3C2440a microcontroller xiii table of contents (continued) chapter 11 uart overview ................................ ................................ ................................ ................................ ............. 11-1 features ................................ ................................ ................................ ................................ ..... 11-1 block diagram ................................ ................................ ................................ ................................ .... 11-2 uart operation ................................ ................................ ................................ ............................. 11-3 uart special registers ................................ ................................ ................................ ......................... 11-10 uart line control register ................................ ................................ ................................ ............ 11-10 uart control register ................................ ................................ ................................ ................... 11-11 uart fifo control register ................................ ................................ ................................ ........... 11-14 uart modem control register ................................ ................................ ................................ ........ 11-15 uart tx/rx status register ................................ ................................ ................................ ........... 11-16 uart error status register ................................ ................................ ................................ ............ 11-17 uart fifo status register ................................ ................................ ................................ ............ 11-18 uart modem status register ................................ ................................ ................................ ........ 11-19 uart transmit buffer register (holding register & fifo register) ................................ ................. 11-20 uart receive buffer register (holding register & fifo register) ................................ .................. 11-20 uart baud rate divisor register ................................ ................................ ................................ .... 11-21 chapter 12 usb host controller overview ................................ ................................ ................................ ................................ ............. 12-1 usb host controller special registers ................................ ................................ ................................ ... 12-2 ohci registers for usb host controller ................................ ................................ ......................... 12-2
xiv S3C2440a microcontroller table of contents (continued) chapter 13 usb device controller overview ................................ ................................ ................................ ................................ ............. 13-1 feature ................................ ................................ ................................ ................................ ....... 13-1 usb device controller special registers ................................ ................................ ................................ 13-3 function address register (func_addr_reg) ................................ ................................ ............ 13-5 power management register (pwr_reg) ................................ ................................ .................... 13-6 interrupt register (ep_int_reg/usb_int_reg) ................................ ................................ ........... 13-7 interrupt enable register (ep_int_en_reg/usb_int_en_reg) ................................ .................... 13-9 frame number register (fpame_num1_reg/frame_num2_reg) ................................ ............. 13-10 index register (index_reg) ................................ ................................ ................................ ........ 13-11 max packet register (maxp_reg) ................................ ................................ .............................. 13-11 end point0 control status register (ep0_csr) ................................ ................................ ............ 13-12 end point in control status register (in_csr1_reg/in_csr2_reg) ................................ ............ 13-13 end point out control status register (out_csr1_reg/out_csr2_reg) ................................ .. 13-15 end point out write count register (out_fifo_cnt1_reg/out_fifo_cnt2_reg) ..................... 13-17 end point fifo register (epn_fifo_reg) ................................ ................................ .................. 13-17 dma interface control register (epn_dma_con) ................................ ................................ ......... 13-18 dma unit counter register (epn_dma_unit) ................................ ................................ ............... 13-19 dma fifo counter register (epn_dma_fifo) ................................ ................................ ............. 13-20 dma total transfer counter register (epn_dma_ttc_l, m, h) ................................ ...................... 13-21 chapter 14 interrupt controller overview ................................ ................................ ................................ ................................ ............. 14-1 interrupt controller operation ................................ ................................ ................................ ........ 14-2 interrupt sources ................................ ................................ ................................ ......................... 14-3 interrupt sub sources ................................ ................................ ................................ .................. 14-4 interrupt priority generating block ................................ ................................ ................................ . 14-5 interrupt priority ................................ ................................ ................................ ........................... 14-6 interrupt controller special registers ................................ ................................ ................................ ..... 14-7 source pending (srcpnd) register ................................ ................................ ............................. 14- 7 interrupt mode (intmod) register ................................ ................................ ................................ . 14-9 interrupt mask (intmsk) register ................................ ................................ ................................ . 14-11 priority register (priority) ................................ ................................ ................................ ......... 14-13 interrupt pending (intpnd) register ................................ ................................ .............................. 14-14 interrupt offset (intoffset) register ................................ ................................ ........................... 14-16 sub source pending (subsrcpnd) register ................................ ................................ ................ 14-17 interrupt sub mask (intsubmsk) register ................................ ................................ ................... 14-18
S3C2440a microcontroller xv table of contents (continued) chapter 15 lcd controller overview ................................ ................................ ................................ ................................ ............. 15-1 features ................................ ................................ ................................ ................................ ..... 15-1 common features ................................ ................................ ................................ ....................... 15-2 external interface signal ................................ ................................ ................................ .............. 15-2 block diagram ................................ ................................ ................................ ............................ 15-3 stn lcd controller operation ................................ ................................ ................................ .............. 15-4 timing generator (timegen) ................................ ................................ ................................ ....... 1 5-4 video operation ................................ ................................ ................................ .......................... 15-5 dithering and frame rate control ................................ ................................ ................................ . 15-7 memory data format (stn, bswp = 0) ................................ ................................ ........................ 15-9 tft lcd controller operation ................................ ................................ ................................ ............... 15-16 video operation ................................ ................................ ................................ .......................... 15-16 memory data format (tft) ................................ ................................ ................................ .......... 15-17 256 palette usage (tft) ................................ ................................ ................................ .............. 15-21 samsung tft lcd panel (3.5? portrait/256k color/reflective a-si/transflective a-si tft lcd) ......................... 15-24 virtual display (tft/stn) ................................ ................................ ................................ ............. 15-25 lcd power enable (stn/tft) ................................ ................................ ................................ ....... 15-26 lcd controller special registers ................................ ................................ ................................ .. 15-27 frame buffer start address 1 register ................................ ................................ .......................... 15-33 chapter 16 adc & touch screen interface overview ................................ ................................ ................................ ................................ ............. 16-1 features ................................ ................................ ................................ ................................ ..... 16-1 adc & touch screen interface operation ................................ ................................ .............................. 16-2 block diagram ................................ ................................ ................................ ............................ 16-2 function descriptions ................................ ................................ ................................ .................. 16-3 adc and touch screen interface special registers ................................ ................................ .............. 16-5 adc control register (adccon) ................................ ................................ ................................ .. 16-5 adc touch screen control register (adctsc) ................................ ................................ .............. 16-6 adc start delay register (adcdly) ................................ ................................ ............................. 16-7 adc conversion data register (adcdat0) ................................ ................................ .................... 16-8 adc conversion data register (adcdat1) ................................ ................................ .................... 16-9 adc touch screen up-down int check register (adcupdn) ................................ ........................ 16-9
xvi S3C2440a microcontroller table of contents (continued) chapter 17 real time clock overview ................................ ................................ ................................ ................................ ............. 17-1 features ................................ ................................ ................................ ................................ ..... 17-1 real time clock operation ................................ ................................ ................................ ........... 17-2 leap year generator ................................ ................................ ................................ .................... 17-2 read/write registers ................................ ................................ ................................ ................... 17-2 backup battery operation ................................ ................................ ................................ ............ 17-2 alarm function ................................ ................................ ................................ ............................ 17-3 tick time interrupt ................................ ................................ ................................ ...................... 17-3 32.768khz x-tal connection example ................................ ................................ .......................... 17-3 real time clock special registers ................................ ................................ ................................ ....... 17-4 real time clock control (rtccon) register ................................ ................................ ................. 17-4 tick time count (ticnt) register ................................ ................................ ................................ 17-4 rtc alarm control (rtcalm) register ................................ ................................ .......................... 17-5 alarm second data (almsec) register ................................ ................................ ..................... 17-6 alarm min data (almmin) register ................................ ................................ ............................ 17-6 alarm hour data (almhour) register ................................ ................................ ....................... 17-6 alarm date data (almdate) register ................................ ................................ ........................ 17-7 alarm mon data (almmon) register ................................ ................................ ......................... 17-7 alarm year data (almyear) register ................................ ................................ ....................... 17-7 bcd second (bcdsec) register ................................ ................................ ................................ . 17-8 bcd minute (bcdmin) register ................................ ................................ ................................ .... 17-8 bcd hour (bcdhour) register ................................ ................................ ................................ ... 17-8 bcd date (bcddate) register ................................ ................................ ................................ .... 17-9 bcd day (bcdday) register ................................ ................................ ................................ ....... 17-9 bcd month (bcdmon) register ................................ ................................ ................................ ... 17-9 bcd year (bcdyear) register ................................ ................................ ................................ ... 17-10 chapter 18 watchdog timer overview ................................ ................................ ................................ ................................ ............. 18-1 features ................................ ................................ ................................ ................................ ..... 18-1 watchdog timer operation ................................ ................................ ................................ ........... 18-2 wtdat & wtcnt ................................ ................................ ................................ ............................ 18-2 consideration of debugging environment ................................ ................................ ....................... 18-2 watchdog timer special registers ................................ ................................ ................................ ....... 18-3 watchdog timer control (wtcon) register ................................ ................................ ................... 18-3 watchdog timer data (wtdat) register ................................ ................................ ....................... 18-4 watchdog timer count (wtcnt) register ................................ ................................ ..................... 18-4
S3C2440a microcontroller xvii table of contents (continued) chapter 19 mmc/sd/sdio controller features ................................ ................................ ................................ ................................ ............. 19-1 block diagram ................................ ................................ ................................ ................................ .... 19-1 sd operation ................................ ................................ ................................ ................................ ...... 19-2 sdio operation ................................ ................................ ................................ ................................ ... 19-3 sdi special registers ................................ ................................ ................................ .......................... 19-4 sdi control register (sdicon) ................................ ................................ ................................ ..... 19-4 sdi baud rate prescaler register (sdipre) ................................ ................................ ................. 19-4 sdi command argument register (sdicmdarg) ................................ ................................ ............. 19-5 sdi command control register (sdicmdcon) ................................ ................................ ................ 19-5 sdi command status register (sdicmdsta) ................................ ................................ ................. 19-6 sdi response register 0 (sdirsp0) ................................ ................................ ............................ 19-6 sdi response register 1 (sdirsp1) ................................ ................................ ............................ 19-6 sdi response register 2 (sdirsp2) ................................ ................................ ............................ 19-7 sdi response register 3 (sdirsp3) ................................ ................................ ............................ 19-7 sdi data / busy timer register (sdidtimer) ................................ ................................ .................. 19-7 sdi block size register (sdibsize) ................................ ................................ .............................. 19-7 sdi data control register (sdidatcon) ................................ ................................ ......................... 19-8 sdi data remain counter register (adidatcnt) ................................ ................................ ............. 19-9 sdi data status register (adidatsta) ................................ ................................ ........................... 19-9 sdi fifo status register (sdifsta) ................................ ................................ ............................ 19-10 sdi interrupt mask register (sdiintmsk) ................................ ................................ ........................ 19-11 sdi data register (sdidat) ................................ ................................ ................................ ......... 19-12 chapter 20 iic-bus interface overview ................................ ................................ ................................ ................................ ............. 20-1 iic-bus interface ................................ ................................ ................................ .......................... 20-3 start and stop conditions ................................ ................................ ................................ ............ 20-3 data transfer format ................................ ................................ ................................ ................... 20-4 ack signal transmission ................................ ................................ ................................ ............. 20-5 read-write operation ................................ ................................ ................................ .................. 20-6 bus arbitration procedures ................................ ................................ ................................ ........... 20-6 abort conditions ................................ ................................ ................................ .......................... 20-6 configuring iic-bus ................................ ................................ ................................ ...................... 20-6 flowcharts of operations in each mode ................................ ................................ ......................... 20-7 iic-bus interface special registers ................................ ................................ ................................ ....... 20-11 multi-master iic-bus control (iiccon) register ................................ ................................ .............. 20-11 multi-master iic-bus control/status (iicstat) register ................................ ................................ ... 20-12 multi-master iic-bus address (iicadd) register ................................ ................................ ............. 20-13 multi-master iic-bus transmit/receive data shift (iicds) register ................................ ................... 20-13 multi-master iic-bus line contro l(iiclc) register ................................ ................................ .......... 20-14
xviii S3C2440a microcontroller table of contents (continued) chapter 21 iis-bus interface overview ................................ ................................ ................................ ................................ ............. 21-1 block diagram ................................ ................................ ................................ ................................ .... 21-2 functional descriptions ................................ ................................ ................................ ........................ 21-2 transmit or receive only mode ................................ ................................ ................................ .... 21-2 dma transfer ................................ ................................ ................................ .............................. 21-3 transmit and receive mode ................................ ................................ ................................ .......... 21-3 audio serial interface format ................................ ................................ ................................ ................ 21-3 iis-bus format ................................ ................................ ................................ ............................ 21-3 msb (left) justified ................................ ................................ ................................ ..................... 21-3 sampling frequency and master clock ................................ ................................ ......................... 21-4 iis-bus interface special registers ................................ ................................ ................................ ....... 21-5 iis control (iiscon) register ................................ ................................ ................................ ........ 21-5 iis mode register (iismod) register ................................ ................................ ............................. 21-6 iis prescaler (iispsr) register ................................ ................................ ................................ ..... 21-7 iis fifo control (iisfcon) register ................................ ................................ .............................. 21-8 iis fifo (iisfifo) register ................................ ................................ ................................ ........... 21-8 chapter 22 spi overview ................................ ................................ ................................ ................................ ............. 22-1 features ................................ ................................ ................................ ................................ ..... 22-1 block diagram ................................ ................................ ................................ ............................ 22-2 spi operation ................................ ................................ ................................ ................................ ..... 22-3 programming procedure ................................ ................................ ................................ ............... 22-3 spi transfer format ................................ ................................ ................................ ..................... 22-4 transmitting procedure for dma ................................ ................................ ................................ ... 22-5 receiving procedure for dma ................................ ................................ ................................ ....... 22-5 spi special registers ................................ ................................ ................................ .......................... 22-6 spi control register ................................ ................................ ................................ .................... 22-6 spi status register ................................ ................................ ................................ ..................... 22-7 spi pin control register ................................ ................................ ................................ .............. 22-8 spi baud rate prescaler register ................................ ................................ ................................ 22-9 spi tx data register ................................ ................................ ................................ ................... 22-9 spi rx data register ................................ ................................ ................................ ................... 22-9
S3C2440a microcontroller xix table of contents (continued) chapter 23 camera interface overview ................................ ................................ ................................ ................................ ............. 23-1 features ................................ ................................ ................................ ................................ ..... 23-1 block diagram ................................ ................................ ................................ ............................ 23-2 timing diagram ................................ ................................ ................................ ........................... 23-3 camera interface operation ................................ ................................ ................................ .................. 23-5 two dma paths ................................ ................................ ................................ .......................... 23-5 clock domain ................................ ................................ ................................ ............................. 23-5 frame memory hirerarchy ................................ ................................ ................................ ............ 23-6 memory storing method ................................ ................................ ................................ ............... 23-8 timing diagram for register setting ................................ ................................ .............................. 23-9 timing diagram for last irq ................................ ................................ ................................ ......... 23-10 camera interface special registers ................................ ................................ ................................ ....... 23-11 source format register ................................ ................................ ................................ ............... 23-11 window option register ................................ ................................ ................................ ............... 23-12 global control register ................................ ................................ ................................ ................ 23-13 y1 start address register ................................ ................................ ................................ ............ 23-13 y2 start address register ................................ ................................ ................................ ............ 23-13 y3 start address register ................................ ................................ ................................ ............ 23-14 y4 start address register ................................ ................................ ................................ ............ 23-14 cb1 start address register ................................ ................................ ................................ ......... 23-14 cb2 start address register ................................ ................................ ................................ ......... 23-14 cb3 start address register ................................ ................................ ................................ ......... 23-15 cb4 start address register ................................ ................................ ................................ ......... 23-15 cr1 start address register ................................ ................................ ................................ ......... 23-15 cr2 start address register ................................ ................................ ................................ ......... 23-15 cr3 start address register ................................ ................................ ................................ ......... 23-16 cr4 start address register ................................ ................................ ................................ ......... 23-16 codec target format register ................................ ................................ ................................ ...... 23-17 codec dma control register ................................ ................................ ................................ ........ 23-19 register setting guide for codec scaler and preview scaler ................................ ........................... 23-20 codec pre-scaler control register 1 ................................ ................................ ............................. 23-21 codec pre-scaler control register 2 ................................ ................................ ............................. 23-21 codec main-scaler control register ................................ ................................ .............................. 23-22 codec dma target area register ................................ ................................ ................................ .. 23-22 codec status register ................................ ................................ ................................ ................. 23-23 rgb1 start address register ................................ ................................ ................................ ....... 23-23 rgb2 start address register ................................ ................................ ................................ ....... 23-23 rgb3 start address register ................................ ................................ ................................ ....... 23-24 rgb4 start address register ................................ ................................ ................................ ....... 23-24 preview target format register ................................ ................................ ................................ .... 23-24 preview dma control register ................................ ................................ ................................ ...... 23-25
xx S3C2440a microcontroller table of contents (continued) chapter 23 camera interface (continued) preview pre-scaler control register 1 ................................ ................................ ........................... 23-25 preview pre-scaler control register 2 ................................ ................................ ........................... 23-26 preview main-scaler control register ................................ ................................ ............................ 23-26 preview dma target area register ................................ ................................ ................................ 23-26 preview status register ................................ ................................ ................................ ............... 23-27 image capture enable register ................................ ................................ ................................ ..... 23-27 chapter 24 ac97 controller overview ................................ ................................ ................................ ................................ ............. 24-1 features ................................ ................................ ................................ ................................ ..... 24-1 ac97 controller operation ................................ ................................ ................................ .................... 24-2 block diagram ................................ ................................ ................................ ............................ 24-2 internal data path ................................ ................................ ................................ ........................ 24-3 operation flow chart ................................ ................................ ................................ ........................... 24-4 ac-link digital interface protocol ................................ ................................ ................................ .......... 24-5 ac-link output frame (sdata_out) ................................ ................................ ........................... 24-6 ac-link input frame (sdata_in) ................................ ................................ ................................ . 24-6 ac97 powerdown ................................ ................................ ................................ ................................ 24-7 ac97 controller special registers ................................ ................................ ................................ ........ 24-9 ac97 global control register (ac_glbctrl) ................................ ................................ ............... 24-9 ac97 global status register (ac_glbstat) ................................ ................................ ................ 24-10 ac97 codec command register (ac_codec_cmd) ................................ ................................ ..... 24-10 ac97 codec status register (ac_codec_stat) ................................ ................................ ......... 24-11 ac97 pcm out/in channel fifo address register (ac_pcmaddr) ................................ ............... 24-11 ac97 mic in channel fifo address register (ac_micaddr) ................................ ........................ 24-12 ac97 pcm out/in channel fifo data register (ac_pcmdata) ................................ ..................... 24-12 ac97 mic in channel fifo data register (ac_micdata) ................................ .............................. 24-12
S3C2440a microcontroller xxi table of contents (continued) chapter 25 bus priorities overview ................................ ................................ ................................ ................................ ............. 25-1 bus priority map ................................ ................................ ................................ ......................... 25-1 chapter 26 mechanical data package dimensions ................................ ................................ ................................ ........................... 26-1 chapter 27 electrical data absolute maximum ratings ................................ ................................ ................................ .................. 27-1 recommended operating conditions ................................ ................................ ................................ ..... 27-2 d.c. electrical characteristics ................................ ................................ ................................ .............. 27-3 a.c. electrical characteristics ................................ ................................ ................................ .............. 27-8
S3C2440a microcontroller xxiii list of figures figure title page number number 1-1 S3C2440a block diagram ................................ ................................ ................................ 1-5 1-2 S3C2440a pin assignments (289-fbga) ................................ ................................ .......... 1-6 2-1 big-endian addresses of bytes within words ................................ ................................ ..... 2-2 2-2 little-endian addresses of bytes within words ................................ ................................ .. 2-2 2-3 register organization in arm state ................................ ................................ .................. 2-4 2-4 register organization in thumb state ................................ ................................ .............. 2-5 2-5 mapping of thumb state registers onto arm state registers ................................ ........... 2-6 2-6 program status register format ................................ ................................ ....................... 2-7 3-1 arm instruction set format ................................ ................................ ............................. 3-1 3-2 branch and exchange instructions ................................ ................................ .................... 3-5 3-3 branch instructions ................................ ................................ ................................ .......... 3-7 3-4 data processing instructions ................................ ................................ ............................ 3-9 3-5 arm shift operations ................................ ................................ ................................ ...... 3-12 3-6 logical shift left ................................ ................................ ................................ .............. 3-12 3-7 logical shift right ................................ ................................ ................................ ........... 3-13 3-8 arithmetic shift right ................................ ................................ ................................ ....... 3-13 3-9 rotate right ................................ ................................ ................................ .................... 3-14 3-10 rotate right extended ................................ ................................ ................................ ..... 3-14 3-11 psr transfer ................................ ................................ ................................ .................. 3-19 3-12 multiply instructions ................................ ................................ ................................ ......... 3-22 3-13 multiply long instructions ................................ ................................ ................................ . 3-25 3-14 single data transfer instructions ................................ ................................ ....................... 3-28 3-15 little-endian offset addressing ................................ ................................ ......................... 3-30 3-16 halfword and signed data transfer with register offset ................................ ....................... 3-34 3-17 halfword and signed data transfer with immediate offset and auto-indexing ......................... 3-35 3-18 block data transfer instructions ................................ ................................ ....................... 3-40 3-19 post-increment addressing ................................ ................................ .............................. 3-41 3-20 pre-increment addressing ................................ ................................ ................................ 3-42 3-21 post-decrement addressing ................................ ................................ ............................. 3-42 3-22 pre-decrement addressing ................................ ................................ ............................... 3-43 3-23 swap instruction ................................ ................................ ................................ .............. 3-47 3-24 software interrupt instruction ................................ ................................ ............................ 3-49 3-25 coprocessor data operation instruction ................................ ................................ ............. 3-51 3-26 coprocessor data transfer instructions ................................ ................................ ............. 3-53 3-27 coprocessor register transfer instructions ................................ ................................ ........ 3-56 3-28 undefined instruction ................................ ................................ ................................ ....... 3-58
xxiv S3C2440a microcontroller list of figures (continued) figure title page number number 4-1 thumb instruction set formats ................................ ................................ ....................... 4-2 4-2 format 1 ................................ ................................ ................................ ......................... 4-5 4-3 format 2 ................................ ................................ ................................ ......................... 4-7 4-4 format 3 ................................ ................................ ................................ ......................... 4-9 4-5 format 4 ................................ ................................ ................................ ......................... 4-11 4-6 format 5 ................................ ................................ ................................ ......................... 4-13 4-7 format 6 ................................ ................................ ................................ ......................... 4-16 4-8 for mat 7 ................................ ................................ ................................ ......................... 4-18 4-9 format 8 ................................ ................................ ................................ ......................... 4-20 4-10 format 9 ................................ ................................ ................................ ......................... 4-22 4-11 format 10 ................................ ................................ ................................ ....................... 4-24 4-12 format 11 ................................ ................................ ................................ ....................... 4-26 4-13 format 12 ................................ ................................ ................................ ....................... 4-28 4-14 format 13 ................................ ................................ ................................ ....................... 4-30 4-15 format 14 ................................ ................................ ................................ ....................... 4-31 4-16 format 15 ................................ ................................ ................................ ....................... 4-33 4-17 format 16 ................................ ................................ ................................ ....................... 4-34 4-18 format 17 ................................ ................................ ................................ ....................... 4-36 4-19 format 18 ................................ ................................ ................................ ....................... 4-37 4-20 format 19 ................................ ................................ ................................ ....................... 4-38 5-1 S3C2440a memory map after reset ................................ ................................ ................. 5-2 5-2 S3C2440a external nwait timing diagram (tacc=4) ................................ ......................... 5-6 5-3 S3C2440a nxbreq/nxback timing diagram ................................ ................................ ... 5-7 5-4 memory interface with 8-bit rom ................................ ................................ ...................... 5-8 5-5 memory interface with 8-bit rom x 2 ................................ ................................ ................. 5-8 5-6 memory interfac e with 8-bit rom x 4 ................................ ................................ ................. 5-9 5-7 memory interface with 16-bit rom ................................ ................................ .................... 5-9 5-8 memory interface with 16-bit sram ................................ ................................ .................. 5-10 5-9 memory interface with 16-bit sram x 2 ................................ ................................ ............. 5-10 5-10 memory interface with 16-bit sdram (4mx16, 4banks) ................................ ....................... 5-11 5-11 memory interface with 16-bit sdram (4mx16x4bank * 2ea) ................................ ................ 5-11 5-12 S3C2440a ngcs timing diagram ................................ ................................ ..................... 5-12 5-13 S3C2440a sdram timing diagram ................................ ................................ .................. 5-13
S3C2440a microcontroller xxv list of figures (continued) figure title page number number 6-1 nand flash controller block diagram ................................ ................................ ............... 6-2 6-2 nand flash controller boot loa der block diagram ................................ ............................ 6-2 6-3 cle & ale timing (tacls=1, twrph0=0, twrph1=0) ................................ ................... 6-4 6-4 nwe & nre timing (twrph0=0, twrph1=0) ................................ ................................ .. 6-4 6-5 nand flash memory mapping ................................ ................................ .......................... 6-9 6-6 a 8-bit nand flash memory interface ................................ ................................ ............... 6-10 6-7 two 8-bit nand flash memory interface ................................ ................................ ............ 6-10 6-8 a 16-bit nand flash memory interface ................................ ................................ ............. 6-11 7-1 clock generator block diagram ................................ ................................ ........................ 7-3 7-2 pll (phase-locked loop) block diagram ................................ ................................ .......... 7-5 7-3 main oscillator circuit examples ................................ ................................ ...................... 7-5 7-4 power-on reset sequence (when the external clock source is a crystal oscillat or) ............... 7-6 7-5 changing slow clock by setting pms value ................................ ................................ ...... 7-7 7-6 example of internal clock change ................................ ................................ ..................... 7-8 7-7 the clock distribution block diagram ................................ ................................ ................ 7-10 7-8 power management state diagram ................................ ................................ ................... 7-11 7-9 issuing exit_from_slow_mode c ommand in pll on s tate ................................ ................... 7-13 7-10 issuing exit_from_slow_mode c ommand a fter l ock t ime ................................ ................... 7-13 7-11 issuing exit_from_slow_mode c ommand and the i nstant pll_on c ommand s imultaneously ................................ ................................ ................................ 7-14 7-12 sleep mode ................................ ................................ ................................ .................. 7-17 8-1 basic dma timing diagram ................................ ................................ .............................. 8-3 8-2 demand/handshake mode comparison ................................ ................................ ............. 8-4 8-3 b urst 4 transfer size ................................ ................................ ................................ ....... 8-5 8-4 single service in demand mode with unit transfer size ................................ ....................... 8-6 8-5 single service in handshake mode with unit transfer size ................................ .................. 8-6 8-6 whole service in handshake mode with unit transfer size ................................ .................. 8-6 10-1 16-bit pwm timer block diagram ................................ ................................ ..................... 10-2 10-2 timer operations ................................ ................................ ................................ ............. 10-3 10-3 example of double buffering function ................................ ................................ ............... 10-4 10-4 example of a timer operation ................................ ................................ ........................... 10-6 10-5 example of pwm ................................ ................................ ................................ ............ 10-7 10-6 inverter on/off ................................ ................................ ................................ ................. 10-8 10-7 the wave form when a dead zone feature is enabled ................................ ...................... 10-9 10-8 timer4 dma mod e operation ................................ ................................ ............................ 10-10
xxvi S3C2440a microcontroller list of figures (continued) figure title page number number 11-1 uart block diagram (with fifo) ................................ ................................ ...................... 11-2 11-2 uart afc interface ................................ ................................ ................................ ........ 11-4 11-3 example showing uart receiving 5 characters with 2 errors ................................ ............. 11-6 11-4 irda function block diagram ................................ ................................ ............................ 11-8 11-5 serial i/o frame timing diagram (normal uart) ................................ ................................ 11-9 11-6 infrared transmit mode frame timing diagram ................................ ................................ ... 11-9 11-7 infrared receive mode frame timing diagram ................................ ................................ .... 11-9 11-8 ncts and delta cts timing diagram ................................ ................................ ................ 11-19 12-1 usb host controller block diagram ................................ ................................ .................. 12-1 13-1 usb device controller block diagram ................................ ................................ ............... 13-2 14-1 interrupt process diagram ................................ ................................ ................................ 14-1 14-2 priority generating block ................................ ................................ ................................ . 14-5 15-1 lcd controller block diagram ................................ ................................ .......................... 15-3 15-2 monochrome display types (stn) ................................ ................................ .................... 15-12 15-3 color display types (stn) ................................ ................................ ............................... 15-13 15-4 8-bit single scan display type stn lcd timing ................................ ................................ 15-15 15-5 16bpp display types (tft) ................................ ................................ ............................. 15-22 15-6 tft lcd timing example ................................ ................................ ................................ . 15-23 15-7 example of scrolling in virtual display (single scan) ................................ .......................... 15-25 15-8 example of pwren function (pwren=1, invpwren=0) ................................ ................ 15-26 16-1 adc and touch screen interface functional block diagram ................................ ................ 16-2 16-2 adc and touch screen operation signal ................................ ................................ ........... 16-4 17-1 real time clock block diagram ................................ ................................ ........................ 17-2 17-2 main oscillator circuit example ................................ ................................ ........................ 17-3 18-1 watchdog timer block diagram ................................ ................................ ........................ 18-2 19-1 sd interface block diagram ................................ ................................ .............................. 19-1 20-1 iic-bus block diagram ................................ ................................ ................................ ..... 20-2 20-2 start and stop condition ................................ ................................ ................................ .. 20-3 20-3 iic-bus interface data format ................................ ................................ ........................... 20-4 20-4 data transfer on the iic-bus ................................ ................................ ............................. 20-5 20-5 acknowledge on the iic-bus ................................ ................................ ............................. 20-5 20-6 operations for master/transmitter mode ................................ ................................ ............ 20- 7 20-7 operations for master/receiver mode ................................ ................................ ................ 20-8 20-8 operations for slave/transmitter mode ................................ ................................ .............. 20-9 20-9 operations for slave/receiver mode ................................ ................................ .................. 20-10
S3C2440a microcontroller xxvii list of figures (continued) figure title page number number 21-1 iis-bus block diagram ................................ ................................ ................................ ..... 21-2 21-2 iis-bus and msb (left)-justified data interface formats ................................ ...................... 21-4 22-1 spi block diagram ................................ ................................ ................................ .......... 22-2 22-2 spi transfer format ................................ ................................ ................................ ......... 22-4 23-1 camif overview ................................ ................................ ................................ .............. 23-2 23-2 itu-r bt 601 input timing diagram ................................ ................................ ................... 23-3 23-3 itu-r bt 656 input timing diagram ................................ ................................ ................... 23-3 23-4 two dma paths ................................ ................................ ................................ .............. 23-5 23-5 camif clock generation ................................ ................................ ................................ .. 23-6 23-6 ping-pong memory hierarchy ................................ ................................ ........................... 23-7 23-7 memory storing style ................................ ................................ ................................ ...... 23-8 23-8 timing diagram for register setting ................................ ................................ .................. 23-9 23-9 timing diagram for last irq ................................ ................................ .............................. 23-10 23-10 window offset scheme ................................ ................................ ................................ .... 23-12 23-11 image mirror and rotation ................................ ................................ ................................ 23-18 23-12 scaling scheme ................................ ................................ ................................ .............. 23-20 24-1 ac97 block diagram ................................ ................................ ................................ ....... 24-2 24-2 internal data path ................................ ................................ ................................ ............ 24-3 24-3 ac97 operation flow chart ................................ ................................ .............................. 24-4 24-4 bi-directional ac-link frame with slot assignments ................................ ............................ 24-5 24-5 ac-link output frame ................................ ................................ ................................ ...... 24-6 24-6 ac-link input frame ................................ ................................ ................................ ......... 24-6 24-7 ac97 powerdown timing diagram ................................ ................................ ..................... 24-7 24-8 ac97 power down/power up flow ................................ ................................ ..................... 24-8 26-1 289-fbga-1414 package dimension 1 (top view) ................................ ............................. 26-1 26-2 289-fbga-1414 package dimension 2 (bottom view) ................................ ........................ 26-2 27-1 power consumption example comparison when applied dvs scheme ................................ 27-7 27-2 xtipll clock timing diagram ................................ ................................ ............................. 27-8 27-3 extclk clock input timing diagram ................................ ................................ ................. 27-8 27-4 extclk/hclk in case when extclk is used without the pll ................................ ........... 27-8 27-5 hclk/clkout/sclk in case when extclk is used ................................ ......................... 27-9 27-6 manual reset input timing d iagram ................................ ................................ .................. 27-9 27-7 power-on oscillation setting timing diagram ................................ ................................ .... 27-10 27-8 sleep mode return oscillation setting timing diagram ................................ ....................... 27-11 27-9 rom/sram burst read timing diagram (i) (tacs=0, tcos=0, tacc=2, toch=0, tcah=0, pmc=0, st=0, dw=16bit) ............................... 27-12 27-10 rom/sram burst read timing diagram (ii) (tacs=0, tcos=0, tacc=2, toch=0, tcah=0, pmc=0, st=1, dw=16bit) ............................... 27-13
xxviii S3C2440a microcontroller list of figures (continued) figure title page number number 27-11 external bus request in rom/sram cycle (tacs=0, tcos=0, tacc=8, toch=0, tcah=0, pmc=0, st=0) ................................ ............... 27-14 27-12 rom/sram read timing diagram (i) (tacs=2, tcos=2, tacc=4, toch=2, tcah=2, pmc=0, st=0) ................................ ............... 27-15 27-13 rom/sram read timing diagram (ii) (tacs=2, tcos=2, tacc=4, toch=2, tcah=2cycle, pmc=0, st=1) ................................ ....... 27-16 27-14 rom/sram write timing diagram (i) (tacs=2,tcos=2,tacc=4,toch=2, tcah=2, pmc=0, st=0 ................................ ................... 27-17 27-15 rom/sram write timing diagram (ii) (tacs=2, tcos=2, tacc=4, toch=2, tcah=2, pmc=0, st=1) ................................ ............... 27-18 27-16 external nwait read timing diagram (tacs=0, tcos=0, tacc=6, toch=0, tcah=0, pmc=0, st=0) ................................ ............... 27-19 27-17 external nwait write timing diagram (tacs=0, tcos=0, tacc=4, toch=0, tcah=0, pmc=0, st=0) ................................ ............... 27-19 27-18 masked-rom single read timing diagram (tacs=2, tcos=2, tacc=8, pmc=01/10/11) ....... 27-20 27-19 masked-rom consecutive read timing diagram (tacs=0, tcos=0, tacc=3, tpac=2, pmc=01/10/11) ................................ ........................... 27-20 27-20 sdram single burst read timing diagram (trp=2, trcd=2, tcl=2, dw=16bit) .................... 27-21 27-21 external bus request in sdram timing diagram (trp=2, trcd=2, tcl=2) ............................. 27-22 27-22 sdr am mrs timing diagram ................................ ................................ .......................... 27-23 27-23 sdram single read timing diagram (i) (trp=2, trcd=2, tcl=2) ................................ ......... 27-24 27-24 sdram single read timing diagram (ii) (trp=2, trcd=2, tcl=3) ................................ ......... 27-25 27-25 sdram auto refresh timing diagram (trp=2, trc=4) ................................ ......................... 27-26 27-26 sdram page hit-miss read timing diagram (trp=2, trcd=2, tcl=2) ................................ .. 27-27 27-27 sdram self refresh timing diagram (trp=2, trc=4) ................................ .......................... 27-28 27-28 sdram single write timing diagram (trp=2, trcd=2) ................................ ........................ 27-29 27-29 sdram page hit-miss write timing diagram (trp=2, trcd=2, tcl=2) ................................ ... 27- 30 27-30 external dma timing diagram (handshake, single transfer) ................................ ................ 27-31 27-31 tft lcd controller timing diagram ................................ ................................ ................... 27-31 27-32 iis interface timing diagram ................................ ................................ ............................. 27-32 27-33 iic interface timing diagram ................................ ................................ ............................. 27-32 27-34 sd/mmc interface timing diagram ................................ ................................ .................... 27-33 27-35 spi interface timing diagram (cpha=1, cpol=1) ................................ ............................. 27-33 27-36 nand flash address/command timing diagram ................................ ............................... 27-34 27-37 nand flash timing diagram ................................ ................................ ............................ 27-34
S3C2440a microcontroller xxix list of tables table title page number number 1-1 289-pin fbga pin assignments ? pin number order (sheet 1 of 3) ................................ ..... 1-7 1-2 S3C2440a 289-pin fbga pin assignments (sheet 1 of 9) ................................ .................. 1-10 1-3 S3C2440a signal descriptions (sheet 1 of 6) ................................ ................................ ..... 1-20 1-4 S3C2440a special registers (sheet 1 of 14) ................................ ................................ ..... 1-26 2-1 psr mode bit values ................................ ................................ ................................ ...... 2-9 2-2 exception entry/exit ................................ ................................ ................................ ........ 2-11 2-3 exception vectors ................................ ................................ ................................ ........... 2-13 3-1 the arm instruction set ................................ ................................ ................................ .. 3-2 3-2 condition code summary ................................ ................................ ................................ . 3-4 3-3 arm data processing instructions ................................ ................................ .................... 3-11 3-4 incremental cycle times ................................ ................................ ................................ .. 3-16 3-5 assembler syntax descriptions ................................ ................................ ........................ 3-27 3-6 addressing mode names ................................ ................................ ................................ . 3-45 4-1 thumb instruction set opcodes ................................ ................................ ...................... 4-3 4-2 summary of format 1 instructions ................................ ................................ .................... 4-5 4-3 summary of format 2 instructions ................................ ................................ .................... 4-7 4-4 summary of format 3 instructions ................................ ................................ .................... 4-9 4-5 summary of format 4 instructions ................................ ................................ .................... 4-11 4-6 summary of format 5 instructions ................................ ................................ .................... 4-13 4-7 summary of pc-relative load instruction ................................ ................................ .......... 4-16 4-8 summary of format 7 instructions ................................ ................................ .................... 4-19 4-9 summary of format 8 instructions ................................ ................................ .................... 4-20 4-10 summary of format 9 instructions ................................ ................................ .................... 4-23 4-11 halfword data transfer instructions ................................ ................................ ................... 4-24 4-12 sp-relative load/store instructions ................................ ................................ .................. 4-26 4-13 load add ress ................................ ................................ ................................ .................. 4-28 4-14 the add sp instruction ................................ ................................ ................................ ... 4-30 4-15 push and pop instructions ................................ ................................ ............................. 4-31 4-16 the multiple load/store instructions ................................ ................................ .................. 4-33 4-17 the conditional branch instructions ................................ ................................ .................. 4-34 4-18 the swi instruction ................................ ................................ ................................ ......... 4-36 4-19 summary of branch instruction ................................ ................................ ......................... 4-37 4-20 the bl instruction ................................ ................................ ................................ ........... 4-39 5-1 bank 6/7 addresses ................................ ................................ ................................ ........ 5-3 5-2 sdram bank address configuration example ................................ ................................ ... 5-5 7-1 clock s ource s election at b oot- u p ................................ ................................ ................... 7-2 7-2 clock and power state in each power mode ................................ ................................ ..... 7-11 7-3 clkslow and clkdivn register settings for slow clock ex ample ................................ . 7-12 7-4 pin configuration table in sleep mode ................................ ................................ ................ 7-16
xxx S3C2440a microcontroller list of tables (continued) table title page number number 8-1 dma request sources for each channel ................................ ................................ ........... 8-2 9-1 S3C2440a port configuration (sheet 1 of 5) ................................ ................................ ....... 9-2 11-1 interrupts in connection with fifo ................................ ................................ ................... 11-5 15-1 relation between vclk and clkval (stn, hclk = 60mhz) ................................ ............. 15-5 15-2 dither duty cycle examples ................................ ................................ ............................. 15-7 15-3 relation between vclk and clkval (tft, hclk = 60mhz) ................................ .............. 15-16 15-4 5:6:5 format ................................ ................................ ................................ ................... 15-21 15-5 5:5:5:1 format ................................ ................................ ................................ ................ 15-21 15-6 mv value for each di splay mode ................................ ................................ ...................... 15-41 21-1 codec clock (codeclk = 256 or 384fs) ................................ ................................ ......... 21-4 21-2 usable serial bit clock frequency (iisclk = 16 or 32 or 48fs) ................................ ............ 21-4 23-1 camera interface signal description ................................ ................................ .................. 23-1 23-2 video timing reference codes of itu-656 format ................................ .............................. 23-4 27-1 absolute maximum rating ................................ ................................ ............................... 27-1 27-2 recommended operating conditions ................................ ................................ ................. 27-2 27-3 normal i/o pad dc electrical characteristics ................................ ................................ .... 27-3 27-4 usb dc electrical characteristics ................................ ................................ .................... 27-6 27-5 S3C2440 power supply voltage and current ................................ ................................ ...... 27-6 27-6 typical c urrent d ecrease by clkcon r egister ................................ ................................ . 27-7 27-7 clock timing constants ................................ ................................ ................................ ... 27-35 27-8 rom/sram bus timing constants ................................ ................................ ................... 27-36 27-9 memory interface timing constants ................................ ................................ .................. 27-36 27-10 external bus request timing constants ................................ ................................ ............ 27-37 27-11 dma controller module signal timing constants ................................ ................................ 27-37 27-12 tft lcd controller module signal timing constants ................................ .......................... 27-38 27-13 iis controller module signal timing constants ................................ ................................ ... 27-38 27-14 iic bus controller module signal timing ................................ ................................ ........... 27-39 27-15 sd/mmc interface transmit/receive timing constants ................................ ....................... 27-39 27-16 spi interface transmit/receive timing constants ................................ ............................... 27-40 27-17 usb electrical specifications ................................ ................................ ........................... 27-40 27-18 usb full speed output buffer electrical characteristics ................................ ..................... 27-41 27-19 usb low speed output buffer electrical characteristics ................................ ..................... 27-41 27-20 nand flash interface timing constants ................................ ................................ ............ 27-42
S3C2440a risc microprocessor product overview 1- 1 1 product overview introduction this user?s manual describes samsung's S3C2440a 16/32-bit risc microprocessor. samsung?s S3C2440a is designed to provide hand-held devices and general applications with low-power, and high-performance micro- controller solution in small die size. to reduce total system cost, the S3C2440a includes the following components. the S3C2440a is developed with arm920t core, 0.13um cmos standard cells and a memory complier. its low- power, simple, elegant and fully static design is particularly suitable for cost- and power-sensitive applications. it adopts a new bus architecture known as advanced micro controller bus architecture (amba). the S3C2440a offers outstanding features with its cpu core, a 16/32-bit arm920t risc processor designed by advanced risc machines, ltd. the arm920t implements mmu, amba bus, and harvard cache architecture with separate 16kb instruction and 16kb data caches, each with an 8-word line length. by providing a complete set of common system peripherals, the S3C2440a minimizes overall system costs and eliminates the need to configure additional components. the integrated on-chip functions that are described in this document include: around 1.2v internal, 1.8v/2.5v/3.3v memory, 3.3v external i/o microprocessor with 16kb i-cache/16kb d- cache/mmu external memory controller (sdram control and chip select logic) lcd controller (up to 4k color stn and 256k color tft) with lcd-dedicated dma 4-ch dma controllers with external request pins 3-ch uarts (irda1.0, 64-byte tx fifo, and 64-byte rx fifo) 2-ch spls iic bus interface (multi-master support) iis audio codec interface ac?97 codec interface sd host interface version 1.0 & mmc protocol version 2.11 compatible 2-ch usb host controller / 1-ch usb device controller (ver 1.1) 4-ch pwm timers / 1-ch internal timer / watch dog timer 8-ch 10-bit adc and touch screen interface rtc with calendar function camera interface (max. 4096 x 4096 pixels input support. 2048 x 2048 pixel input support for scaling) 130 general purpose i/o ports / 24-ch external interrupt source power control: normal, slow, idle and sleep mode on-chip clock generator with pll
product overview s3c24 40a risc microprocessor 1- 2 features architecture integrated system for hand-held devices and general embedded applications. 16/32-bit risc architecture and powerful instruction set with arm920t cpu core. enhanced arm architecture mmu to support wince, epoc 32 and linux. instruction cache, data cache, write buffer and physical address tag ram to reduce the effect of main memory bandwidth and latency on performance. arm920t cpu core supports the arm debug architecture. internal advanced microcontroller bus architecture (amba) (amba2.0, ahb/apb). system manager little/big endian support. support fast bus mode and asynchronous bus mode. address space: 128m bytes for each bank (total 1g bytes). supports programmable 8/16/32-bit data bus width for each bank. fixed bank start address from bank 0 to bank 6. programmable bank start address and bank size for bank 7. eight memory banks: ? six memory banks for rom, sram, and others. ? two memory banks for rom/sram/ synchronous dram. complete programmable access cycles for all memory banks. supports external wait signals to expand the bus cycle. supports self-refresh mode in sdram for power- down. supports various types of rom for booting (nor/nand flash, eeprom, and others). nand flash boot loader supports booting from nand flash memory. 4kb internal buffer for booting. supports storage memory for nand flash memory after booting. supports advanced nand flash cache memory 64-way set-associative cache with i-cache (16kb) and d-cache (16kb). 8words length per line with one valid bit and two dirty bits per line. pseudo random or round robin replacement algorithm. write-through or write-back cache operation to update the main memory. the write buffer can hold 16 words of data and four addresses. clock & power manager on-chip mpll and upll: upll generates the clock to operate usb host/device. mpll generates the clock to operate mcu at maximum 400mhz @ 1.3v. clock can be fed selectively to each function block by software. power mode : normal, slow, idle, and sleep mode normal mode : normal operating mode slow mode : low frequency clock without pll idle mode : the clock for only cpu is stopped. sleep mode : the core power including all peripherals is shut down. woken up by eint[15:0] or rtc alarm interrupt from sleep mode
S3C2440a risc microprocessor product o verview 1- 3 features ( continued) interrupt controller 60 interrupt sources (one watch dog timer, 5 timers, 9 uarts, 24 external interrupts, 4 dma, 2 rtc, 2 adc, 1 iic, 2 spi, 1 sdi, 2 usb, 1 lcd, 1 battery fault, 1 nand and 2 camera), 1 ac97 level/edge mode on external interrupt source programmable polarity of edge and level supports fast interrupt request (fiq) for very urgent interrupt request timer with pulse width modulation (pwm) 4-ch 16-bit timer with pwm / 1-ch 16-bit internal timer with dma-based or interrupt-based operation programmable duty cycle, frequency, and polarity dead-zone generation supports external clock sources rtc (real time clock) full clock feature: msec, second, minute, hour, date, day, month, and year 32.768 khz operation alarm interrupt time tick interrupt general purpose input/output ports 24 external interrupt ports 130 multiplexed input/output ports dma controller 4-ch dma controller supports memory to memory, io to memory, memory to io, and io to io transfers burst transfer mode to enhance the transfer rate lcd controller stn lcd displays feature supports 3 types of stn lcd panels: 4-bit dual scan, 4-bit single scan, 8-bit single scan display type supports monochrome mode, 4 gray levels, 16 gray levels, 256 colors and 4096 colors for stn lcd supports multiple screen size ? typical actual screen size: 640x480, 320x240, 160x160, and others. ? maximum frame buffer size is 4 mbytes. ? maximum virtual screen size in 256 color mode: 4096x1024, 2048x2048, 1024x4096 and others tft(thin film transistor) color displays feature supports 1, 2, 4 or 8 bpp (bit-per-pixel) palette color displays for color tft supports 16, 24 bpp non-palette true-color displays for color tft supports maximum 16m color tft at 24 bpp mode lpc3600 timing controller embedded for lts350q1-pd1/2(samsung 3.5? portrait / 256k- color/ reflective a-si tft lcd) lcc3600 timing controller embedded for lts350q1-pe1/2(samsung 3.5? portrait / 256k- color/ transflective a-si tft lcd) supports multiple screen size ? typical actual screen size: 640x480, 320x240, 160x160, and others. ? maximum frame buffer size is 4mbytes. ? maximum virtual screen size in 64k color mode: 2048x1024, and others uart 3-channel uart with dma-based or interrupt- based operation supports 5-bit, 6-bit, 7-bit, or 8-bit serial data transmit/receive (tx/rx) supports external clocks for the uart operation (uextclk) programmable baud rate supports irda 1.0 loopback mode for testing each channel has internal 64-byte tx fifo and 64-byte rx fifo.
product overview s3c24 40a risc microprocessor 1- 4 features ( continued) a/d converter & touch screen interface 8-ch multiplexed adc max. 500ksps and 10-bit resolution internal fet for direct touch screen interface watchdog timer 16-bit watchdog timer interrupt request or system reset at time-out iic-bus interface 1-ch multi-master iic-bus serial, 8-bit oriented and bi-directional data transfers can be made at up to 100 kbit/s in standard mode or up to 400 kbit/s in fast mode. iis-bus interface 1-ch iis-bus for audio interface with dma-based operation serial, 8-/16-bit per channel data transfers 128 bytes (64-byte + 64-byte) fifo for tx/rx supports iis format and msb-justified data format ac97 audio-codec interface support 16-bit samples 1-ch stereo pcm inputs/ 1-ch stereo pcm outputs 1-ch mic input usb host 2-port usb host complies with ohci rev. 1.0 compatible with usb specification version 1.1 usb device 1-port usb device 5 endpoints for usb device compatible with usb specification version 1.1 sd host interface normal, interrupt and dma data transfer mode (byte, halfword, word transfer) dma burst4 access support (only word transfer) compatible with sd memory card protocol version 1.0 compatible with sdio card protocol version 1.0 64 bytes fifo for tx/rx compatible with multimedia card protocol version 2.11 spi interface compatible with 2-ch serial peripheral interface protocol version 2.11 2x8 bits shift register for tx/rx dma-based or interrupt-based operation camera interface itu-r bt 601/656 8-bit mode support dzi (digital zoom in) capability programmable polarity of video sync signals max. 4096 x 4096 pixels input support (2048 x 2048 pixel input support for scaling) image mirror and rotation (x-axis mirror, y-axis mirror, and 180 rotation) camera output format (rgb 16/24-bit and ycbcr 4:2:0/4:2:2 format) operating voltage range core: 1.20v for 300mhz 1.30v for 400mhz memory: 1.8v/ 2.5v/3.0v/3.3v i/o: 3.3v operating frequency fclk up to 400mhz hclk up to 136mhz pclk up to 68mhz package 289-fbga
S3C2440a risc microprocessor product o verview 1- 5 block diagram arm920t arm9tdmi processor core (internal embedded ice) dd[31:0] writeback pa tag ram data mmu c13 dva[31:0] dv a[31:0] instructionc ache (16kb) instruction mmu external coproc interface c13 id[31:0] ipa[31:0] iv a[31:0] cp15 write buffer amba bus i/f jtag data cache (16kb) wbpa[31:0] dpa[31:0] bridge & dma (4ch) clock generator ( m pll) a h b b u s memory cont. sram/nor/sdram bus cont. arbitor/decode power management interrupt cont. usb host cont. extmaster lcd dma lcd cont. a p b b u s i2c gpio i2s rtc spi adc sdi/mmc usb device watchdog timer bus cont. arbitor/decode timer/pwm 0 ~ 3, 4(internal) spi 0, 1 uart 0, 1, 2 nand ctrl. nand flash boot loader camera interface ac97 figure 1-1. S3C2440a block diagram
product overview s3c24 40a risc microprocessor 1- 6 pin assignments bottom view u t r p n m l k j h g f e d c b a 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 figure 1-2. S3C2440a pin assignments (289-fbga)
S3C2440a risc microprocessor product o verview 1- 7 table 1-1. 289-pin fbga pin assignments ? pin number order (sheet 1 of 3) pin number pin name pin number pin name pin number pin name a1 vddi c1 vddmop e1 nfre/gpa20 a2 scke c2 ngcs5/gpa16 e2 vssmop a3 vssi c3 ngcs2/gpa13 e3 ngcs7 a4 vssi c4 ngcs3/gpa14 e4 nwait a5 vssmop c5 noe e5 nbe3 a6 vddi c6 nsras e6 nwe a7 vssmop c7 addr4 e7 addr1 a8 addr10 c8 addr11 e8 addr6 a9 vddmop c9 addr15 e9 addr14 a10 vddi c10 addr21/gpa6 e10 addr23/gpa8 a11 vssmop c11 addr24/gpa9 e11 data2 a12 vssi c12 data1 e12 data20 a13 data3 c13 data6 e13 data19 a14 data7 c14 data11 e14 data18 a15 vssmop c15 data13 e15 data17 a16 vddi c16 data16 e16 data21 a17 data10 c17 vssi e17 data24 b1 vssmop d1 ale/gpa18 f1 vddi b2 ngcs1/gpa12 d2 ngcs6 f2 vssi b3 sclk1 d3 ngcs4/gpa15 f3 nfwe/gpa19 b4 sclk0 d4 nbe0 f4 nfce/gpa22 b5 nbe1 d5 nbe2 f5 cle/gpa17 b6 vddmop d6 nscas f6 ngcs0 b7 addr2 d7 addr7 f7 addr0/gpa0 b8 addr9 d8 addr5 f8 addr3 b9 addr12 d9 addr16/gpa1 f9 addr18/gpa3 b10 vssi d10 addr20/gpa5 f10 data4 b11 vddi d11 addr26/gpa11 f11 data5 b12 vddmop d12 data0 f12 data27 b13 vssmop d13 data8 f13 data31 b14 vddmop d14 data14 f14 data26 b15 data9 d15 data12 f15 data22 b16 vddmop d16 vssmop f16 vddi b17 data15 d17 vssmop f17 vddmop
product overview s3c24 40a risc microprocessor 1- 8 table 1-1. 289-pin fbga pin assignments ? pin number order (sheet 2 of 3) (continued) pin number pin name pin number pin name pin number pin name g1 vssop j1 vddop l1 lend/gpc0 g2 camhref/gpj10 j2 vddiarm l2 vddiarm g3 camdata1/gpj1 j3 camclkout/gpj11 l3 nxdack0/gpb9 g4 vddalive j4 camreset/gpj12 l4 vclk/gpc1 g5 campclk/gpj8 j5 tout1/gpb1 l5 nxbreq/gpb6 g6 frnb j6 tout0/gpb0 l6 vd1/gpc9 g7 camvsync/gpj9 j7 tout2/gpb2 l7 vframe/gpc3 g8 addr8 j8 camdata6/gpj6 l8 i2ssdi/ac_sdata_in g9 addr17/gpa2 j9 sddat3/gpe10 l9 spiclk0/gpe13 g10 addr25/gpa10 j10 eint10/nss0/gpg2 l10 eint15/spiclk1/gpg7 g11 data28 j11 txd2/nrts1/gph6 l11 eint22/gpg14 g12 data25 j12 pwren l12 xtortc g13 data23 j13 tck l13 eint2/gpf2 g14 xtipll j14 tms l14 eint5/gpf5 g15 xtopll j15 rxd2/ncts1/gph7 l15 eint6/gpf6 g16 data29 j16 tdo l16 eint7/gpf7 g17 vssi j17 vddalive l17 nrts0/gph1 h1 vssiarm k1 vssiarm m1 vline/gpc2 h2 camdata7/gpj7 k2 nxback/gpb5 m2 lcd_lpcrev/gpc6 h3 camdata4/gpj4 k3 tout3/gpb3 m3 lcd_lpcoe/gpc5 h4 camdata3/gpj3 k4 tclk0/gpb4 m4 vm/gpc4 h5 camdata2/gpj2 k5 nxdreq1/gpb8 m5 vd9/gpd1 h6 camdata0/gpj0 k6 nxdreq0/gpb10 m6 vd6/gpc14 h7 camdata5/gpj5 k7 nxdack1/gpb7 m7 vd16/spimiso1/gpd8 h8 addr13 k8 sdcmd/gpe6 m8 sddat1/gpe8 h9 addr19/gpa4 k9 spimiso0/gpe11 m9 iicsda/gpe15 h10 addr22/gpa7 k10 eint13/spimiso1/gpg5 m10 eint20/gpg12 h11 vssop k11 ncts0/gph0 m11 eint17/nrts1/gpg9 h12 extclk k12 vddop m12 vssa_upll h13 data30 k13 txd0/gph2 m13 vdda_upll h14 nbatt_flt k14 rxd0/gph3 m14 xtirtc h15 ntrst k15 uextclk/gph8 m15 eint3/gpf3 h16 nreset k16 txd1/gph4 m16 eint1/gpf1 h17 tdi k17 rxd1/gph5 m17 eint4/gpf4
S3C2440a risc microprocessor product o verview 1- 9 table 1-1. 289-pin fbga pin assignments ? pin number order (sheet 3 of 3) (continued) pin number pin name pin number pin name pin number pin name n1 vssop p15 ain3 t12 vddop n2 vd0/gpc8 p16 xp/ain7 t13 om3 n3 vd4/gpc12 p17 upllcap t14 vssa_adc n4 vd2/gpc10 r1 vd3/gpc11 t15 om0 n5 vd10/gpd2 r2 vd8/gpd0 t16 ym/ain4 n6 vd15/gpd7 r3 vd11/gpd3 t17 yp/ain5 n7 vd22/nss1/gpd14 r4 vd13/gpd5 u1 vddiarm n8 sdclk/gpe5 r5 vd18/spiclk1/gpd10 u2 vddiarm n9 eint8/gpg0 r6 vd21 /gpd13 u3 vssop n10 eint18/ncts1/gpg10 r7 i2ssclk/ac_bit_clk u4 vssiarm n11 dp0 r8 sddat0/gpe7 u5 vd23/nss0/gpd15 n12 dn1/pdn0 r9 clkout0/gph9 u6 i2ssdo/ac_sdata_ out n13 nrstout/gpa21 r10 eint11/nss1/gpg3 u7 vssiarm n14 mpllcap r11 eint14/spimosi1/gpg6 u8 iicscl/gpe14 n15 vdd_rtc r12 ncon u9 vssop n16 vdda_mpll r13 om1 u10 vssiarm n17 eint0/gpf0 r14 ain0 u11 vddi p1 lcd_lpcrevb/gpc7 r15 ain2 u12 eint19/tclk1/gpg11 p2 vd5/gpc13 r16 xm/ain6 u13 eint23/gpg15 p3 vd7/gpc15 r17 vssa_mpll u14 dp1/pdp0 p4 vd12/gpd4 t1 vssiarm u15 vssop p5 vd14/gpd6 t2 vssiarm u16 vref p6 vd20/gpd12 t3 vddop u17 ain1 p7 i2slrck/ac_sync t4 vd17/spimosi1/gpd9 p8 sddat2/gpe9 t5 vd19/gpd11 p9 spimosi0/gpe12 t6 vddiarm p10 clkout1/gph10 t7 cdclk/ac_nreset p11 eint12/lcd_pwren/ gpg4 t8 vddiarm p12 dn0 t9 eint9/gpg1 p13 om2 t10 eint16/gpg8 p14 vdda_adc t11 eint21/gpg13
product overview s3c24 40a risc microprocessor 1- 10 table 1-2. S3C2440a 289-pin fbga pin assignments (sheet 1 of 9) pin number pin name default function i/o state @bus req i/o state @sleep i/o state @nreset i/o type f7 addr0/gpa0 addr0 hi-z/? o(l)/? o(l) t10s e7 addr1 addr1 hi-z o(l) o(l) t10s b7 addr2 addr2 hi-z o(l) o(l) t10s f8 addr3 addr3 hi-z o(l) o(l) t10s c7 addr4 addr4 hi-z o(l) o(l) t10s d8 addr5 addr5 hi-z o(l) o(l) t10s e8 addr6 addr6 hi-z o(l) o(l) t10s d7 addr7 addr7 hi-z o(l) o(l) t10s g8 addr8 addr8 hi-z o(l) o(l) t10s b8 addr9 addr9 hi-z o(l) o(l) t10s a8 addr10 addr10 hi-z o(l) o(l) t10s c8 addr11 addr11 hi-z o(l) o(l) t10s b9 addr12 addr12 hi-z o(l) o(l) t10s h8 addr13 addr13 hi-z o(l) o(l) t10s e9 addr14 addr14 hi-z o(l) o(l) t10s c9 addr15 addr15 hi-z o(l) o(l) t10s d9 addr16/gpa1 addr16 hi-z/? o(l)/? o(l) t10s g9 addr17/gpa2 addr17 hi-z/? o(l)/? o(l) t10s f9 addr18/gpa3 addr18 hi-z/? o(l)/? o(l) t10s h9 addr19/gpa4 addr19 hi-z/? o(l)/? o(l) t10s d10 addr20/gpa5 addr20 hi-z/? o(l)/? o(l) t10s c10 addr21/gpa6 addr21 hi-z/? o(l)/? o(l) t10s h10 addr22/gpa7 addr22 hi-z/? o(l)/? o(l) t10s e10 addr23/gpa8 addr23 hi-z/? o(l)/? o(l) t10s c11 addr24/gpa9 addr24 hi-z/? o(l)/? o(l) t10s g10 addr25/gpa10 addr25 hi-z/? o(l)/? o(l) t10s d11 addr26/gpa11 addr26 hi-z/? o(l)/? o(l) t10s r14 ain0 ain0 ? ? ai r10 u17 ain1 ain1 ? ? ai r10 r15 ain2 ain2 ? ? ai r10 p15 ain3 ain3 ? ? ai r10 t16 ym/ain4 ain4 ?/? ?/? ai r10 t17 yp/ain5 yp ?/? ?/? ai r10 r16 xm/ain6 ain6 ?/? ?/? ai r10
S3C2440a risc microprocessor product o verview 1- 11 table 1-2. S3C2440a 289-pin fbga pin assignments (sheet 2 of 9) (continued) pin number pin name default function i/o state @bus req i/o state @sleep i/o state @nreset i/o type p16 xp/ain7 xp ?/? ?/? ai r10 h6 camdata0/gpj0 gpj0 ?/? hi-z/? i t8 g3 camdata1/gpj1 gpj1 ?/? hi-z/? i t8 h5 camdata2/gpj2 gpj2 ?/? hi-z/? i t8 h4 camdata3/gpj3 gpj3 ?/? hi-z/? i t8 h3 camdata4/gpj4 gpj4 ?/? hi-z/? i t8 h7 camdata5/gpj5 gpj5 ?/? hi-z/? i t8 j8 camdata6/gpj6 gpj6 ?/? hi-z/? i t8 h2 camdata7/gpj7 gpj7 ?/? hi-z/? i t8 g5 campclk/gpj8 gpj8 ?/? hi-z/? i t8 g7 camvsync/gpj9 gpj9 ?/? hi-z/? i t8 g2 camhref/gpj10 gpj10 ?/? hi-z/? i t8 j3 camclkout/gpj11 gpj11 ?/? o(l)/? i t8 j4 camreset/gpj12 gpj12 ?/? o(l)/? i t8 d12 data0 data0 hi-z hi-z,o(l) i b12s c12 data1 data1 hi-z hi-z,o(l) i b12s e11 data2 data2 hi-z hi-z,o(l) i b12s a13 data3 data3 hi-z hi-z,o(l) i b12s f10 data4 data4 hi-z hi-z,o(l) i b12s f11 data5 data5 hi-z hi-z,o(l) i b12s c13 data6 data6 hi-z hi-z,o(l) i b12s a14 data7 data7 hi-z hi-z,o(l) i b12s d13 data8 data8 hi-z hi-z,o(l) i b12s b15 data9 data9 hi-z hi-z,o(l) i b12s a17 data10 data10 hi-z hi-z,o(l) i b12s c14 data11 data11 hi-z hi-z,o(l) i b12s d15 data12 data12 hi-z hi-z,o(l) i b12s c15 data13 data13 hi-z hi-z,o(l) i b12s d14 data14 data14 hi-z hi-z,o(l) i b12s b17 data15 data15 hi-z hi-z,o(l) i b12s c16 data16 data16 hi-z hi-z,o(l) i b12s e15 data17 data17 hi-z hi-z,o(l) i b12s e14 data18 data18 hi-z hi-z,o(l) i b12s
product overview s3c24 40a risc microprocessor 1- 12 table 1-2. S3C2440a 289-pin fbga pin assignments (sheet 3 of 9) (continued) pin number pin name default function i/o state @bus req i/o state @sleep i/o state @nreset i/o type e13 data19 data19 hi-z hi-z,o(l) i b12s e12 data20 data20 hi-z hi-z,o(l) i b12s e16 data21 data21 hi-z hi-z,o(l) i b12s f15 data22 data22 hi-z hi-z,o(l) i b12s g13 data23 data23 hi-z hi-z,o(l) i b12s e17 data24 data24 hi-z hi-z,o(l) i b12s g12 data25 data25 hi-z hi-z,o(l) i b12s f14 data26 data26 hi-z hi-z,o(l) i b12s f12 data27 data27 hi-z hi-z,o(l) i b12s g11 data28 data28 hi-z hi-z,o(l) i b12s g16 data29 data29 hi-z hi-z,o(l) i b12s h13 data30 data30 hi-z hi-z,o(l) i b12s f13 data31 data31 hi-z hi-z,o(l) i b12s p12 dn0 dn0 ? ? ai us n11 dp0 dp0 ? ? ai us n12 dn1/pdn0 dn1 ?/? ? ai us u14 dp1/pdp0 dp1 ?/? ? ai us n17 eint0/gpf0 gpf0 ?/? hi-z/? i t8 m16 eint1/gpf1 gpf1 ?/? hi-z/? i t8 l13 eint2/gpf2 gpf2 ?/? hi-z/? i t8 m15 eint3/gpf3 gpf3 ?/? hi-z/? i t8 m17 eint4/gpf4 gpf4 ?/? hi-z/? i t8 l14 eint5/gpf5 gpf5 ?/? hi-z/? i t8 l15 eint6/gpf6 gpf6 ?/? hi-z/? i t8 l16 eint7/gpf7 gpf7 ?/? hi-z/? i t8 n9 eint8/gpg0 gpg0 ?/? hi-z/? i t8 t9 eint9/gpg1 gpg1 ?/? hi-z/? i t8 j10 eint10/nss0/gpg2 gpg2 ?/?/? hi-z/hi-z/? i t8 r10 eint11/nss1/gpg3 gpg3 ?/?/? hi-z/hi-z/? i t8 p11 eint12/lcd_pwren/gpg 4 gpg4 ?/?/? hi-z/o(l)/? i t8 k10 eint13/spimiso1/gpg5 gpg5 ?/?/? hi-z/hi-z/? i t8 r11 eint14/spimosi1/gpg6 gpg6 ?/?/? hi-z/hi-z/? i t8 l10 eint15/spiclk1/gpg7 gpg7 ?/?/? hi-z/hi-z/? i t8
S3C2440a risc microprocessor product o verview 1- 13 table 1-2. S3C2440a 289-pin fbga pin assignments (sheet 4 of 9) (continued) pin number pin name default function i/o state @bus req i/o state @sleep i/o state @nreset i/o type t10 eint16/gpg8 gpg8 ?/? hi-z/? i t8 m11 eint17/nrts1/gpg9 gpg9 ?/?/? hi-z/o(h)/? i t8 n10 eint18/ncts1/gpg10 gpg10 ?/?/? hi-z/hi-z/? i t8 u12 eint19/tclk1/gpg11 gpg11 ?/?/? hi-z/hi-z/? i t12 m10 eint20/gpg12 gpg12 ?/? hi-z/? i t12 t11 eint21/gpg13 gpg13 ?/? hi-z/? i t12 l11 eint22/gpg14 gpg14 ?/? hi-z/? i t12 u13 eint23/gpg15 gpg15 ?/? hi-z/? i t12 h12 extclk extclk ? ? ai is p17 upllcap upllcap ? ? ai r50 n14 mpllcap mpllcap ? ? ai r50 h14 nbatt_flt nbatt_flt ? ? i is d4 nbe0 nbe0 hi-z hi-z,o(h) o(h) t10s b5 nbe1 nbe1 hi-z hi-z,o(h) o(h) t10s d5 nbe2 nbe2 hi-z hi-z,o(h) o(h) t10s e5 nbe3 nbe3 hi-z hi-z,o(h) o(h) t10s r12 ncon ncon ? ? i is g6 frnb frnb ? hi-z,o(l) i d2s f3 nfwe/gpa19 gpa19 o(h)/? hi-z,o(h)/? o(h) t10s e1 nfre/gpa20 gpa20 o(h)/? hi-z,o(h)/? o(h) t10s f4 nfce/gpa22 gpa21 o(h)/? hi-z,o(h)/? o(h) t10s f5 cle/gpa17 gpa17 o(l)/? hi-z,o(l)/? o(l) t10s d1 ale/gpa18 gpa18 o(l)/? hi-z,o(l)/? o(l) t10s n13 nrstout/gpa21 gpa21 ?/? o(l)/? o(l) b8 c5 noe noe hi-z hi-z,o(h) o(h) t10s h16 nreset nreset ? ? i is f6 ngcs0 ngcs0 hi-z hi-z,o(h) o(h) t10s b2 ngcs1/gpa12 gpa12 hi-z/? hi-z,o(h)/? o(h) t10s c3 ngcs2/gpa13 gpa13 hi-z/? hi-z,o(h)/? o(h) t10s c4 ngcs3/gpa14 gpa14 hi-z/? hi-z,o(h)/? o(h) t10s d3 ngcs4/gpa15 gpa15 hi-z/? hi-z,o(h)/? o(h) t10s c2 ngcs5/gpa16 gpa16 hi-z/? hi-z,o(h)/? o(h) t10s d2 ngcs6 ngcs6 hi-z hi-z,o(h) o(h) t10s
product overview s3c24 40a risc microprocessor 1- 14 table 1-2. S3C2440a 289-pin fbga pin assignments (sheet 5 of 9) (continued) pin number pin name default function i/o state @bus req i/o state @sleep i/o state @nreset i/o type e3 ngcs7 ngcs7 hi-z hi-z,o(h) o(h) t10s d6 nscas nscas hi-z hi-z,o(h) o(h) t10s c6 nsras nsras hi-z hi-z,o(h) o(h) t10s h15 ntrst ntrst i ? i is e4 nwait nwait ? hi-z,o(l) i d2s e6 nwe nwe hi-z hi-z,o(h) o(h) t10s j6 tout0/gpb0 gpb0 ?/? o(l)/? i t8 j5 tout1/gpb1 gpb1 ?/? o(l)/? i t8 j7 tout2/gpb2 gpb2 ?/? o(l)/? i t8 k3 tout3/gpb3 gpb3 ?/? o(l)/? i t8 k4 tclk0/gpb4 gpb4 ?/? ?/? i t8 k2 nxback/gpb5 gpb5 ?/? o(h)/? i t8 l5 nxbreq/gpb6 gpb6 ?/? ?/? i t8 k7 nxdack1/gpb7 gpb7 ?/? o(h)/? i t8 k5 nxdreq1/gpb8 gpb8 ?/? ?/? i t8 l3 nxdack0/gpb9 gpb9 ?/? o(h)/? i t8 k6 nxdreq0/gpb10 gpb10 ?/? ?/? i t8 t15 om0 om0 ? ? i is r13 om1 om1 ? ? i is p13 om2 om2 ? ? i is t13 om3 om3 ? ? i is j12 pwren pwren o(h) o(l) o(h) b8 k11 ncts0/gph0 gph0 ?/? ?/? i t8 l17 nrts0/gph1 gph1 ?/? o(h)/? i t8 k13 txd0/gph2 gph2 ?/? o(h)/? i t8 k14 rxd0/gph3 gph3 ?/? ?/? i t8 k16 txd1/gph4 gph4 ?/? o(h)/? i t8 k17 rxd1/gph5 gph5 ?/? ?/? i t8 j11 txd2/nrts1/gph6 gph6 ?/?/? o(h)/o(h)/? i t8 j15 rxd2/ncts1/gph7 gph7 ?/?/? hi-z/hi-z/? i t8 k15 uextclk/gph8 gph8 ?/? hi-z/? i t8 r9 clkout0/gph9 gph9 ?/? o(l)/? i t12 p10 clkout1/gph10 gph10 ?/? o(l)/? i t12
S3C2440a risc microprocessor product o verview 1- 15 table 1-2. S3C2440a 289-pin fbga pin assignments (sheet 6 of 9) (continued) pin number pin name default function i/o state @bus req i/o state @sleep i/o state @nreset i/o type a2 scke scke hi-z o(l) o(h) t10s b4 sclk0 sclk0 hi-z o(l) o(sclk) t12s b3 sclk1 sclk1 hi-z o(l) o(sclk) t12s p7 i2slrck/ac_sync gpe0 ?/? hi-z/? i t8 r7 i2ssclk/ac_bit_clk gpe1 ?/? hi-z/? i t8 t7 cdclk/ac_nreset gpe2 ?/? hi-z/? i t8 l8 i2ssdi/ac_sdata_in gpe3 ?/?/? hi-z/hi-z/? i t8 u6 i2ssdo/ac_sdata_out gpe4 ?/?/? o(l)/hi-z/? i t8 n8 sdclk/gpe5 gpe5 ?/? o(l)/? i t8 k8 sdcmd/gpe6 gpe6 ?/? hi-z/? i t8 r8 sddat0/gpe7 gpe7 ?/? hi-z/? i t8 m8 sddat1/gpe8 gpe8 ?/? hi-z/? i t8 p8 sddat2/gpe9 gpe9 ?/? hi-z/? i t8 j9 sddat3/gpe10 gpe10 ?/? hi-z/? i t8 k9 spimiso0/gpe11 gpe11 ?/? hi-z/? i t8 p9 spimosi0/gpe12 gpe12 ?/? hi-z/? i t8 l9 spiclk0/gpe13 gpe13 ?/? hi-z/? i t8 u8 iicscl/gpe14 gpe14 ?/? hi-z/? i d8 m9 iicsda/gpe15 gpe15 ?/? hi-z/? i d8 j13 tck tck i ? i is h17 tdi tdi i ? i is j16 tdo tdo o o o ot j14 tms tms i ? i is l1 lend/gpc0 gpc0 ?/? o(l)/? i t8 l4 vclk/gpc1 gpc1 ?/? o(l)/? i t8 m1 vline/gpc2 gpc2 ?/? o(l)/? i t8 l7 vframe/gpc3 gpc3 ?/? o(l)/? i t8 m4 vm/gpc4 gpc4 ?/? o(l)/? i t8 m3 lcd_lpcoe/gpc5 gpc5 ?/? o(l)/? i t8 m2 lcd_lpcrev/gpc6 gpc6 ?/? o(l)/? i t8 p1 lcd_lpcrevb/gpc7 gpc7 ?/? o(l)/? i t8 n2 vd0/gpc8 gpc8 ?/? o(l)/? i t8 l6 vd1/gpc9 gpc9 ?/? o(l)/? i t8
product overview s3c24 40a risc microprocessor 1- 16 table 1-2. S3C2440a 289-pin fbga pin assignments (sheet 7 of 9) (continued) pin number pin name default function i/o state @bus req i/o state @sleep i/o state @nreset i/o type n4 vd2/gpc10 gpc10 ?/? o(l)/? i t8 r1 vd3/gpc11 gpc11 ?/? o(l)/? i t8 n3 vd4/gpc12 gpc12 ?/? o(l)/? i t8 p2 vd5/gpc13 gpc13 ?/? o(l)/? i t8 m6 vd6/gpc14 gpc14 ?/? o(l)/? i t8 p3 vd7/gpc15 gpc15 ?/? o(l)/? i t8 r2 vd8/gpd0 gpd0 ?/? o(l)/? i t8 m5 vd9/gpd1 gpd1 ?/? o(l)/? i t8 n5 vd10/gpd2 gpd2 ?/? o(l)/? i t8 r3 vd11/gpd3 gpd3 ?/? o(l)/? i t8 p4 vd12/gpd4 gpd4 ?/? o(l)/? i t8 r4 vd13/ gpd5 gpd5 ?/?/? o(l)/o/? i t8 p5 vd14/gpd6 gpd6 ?/?/? o(l)/o/? i t8 n6 vd15/gpd7 gpd7 ?/?/? o(l)/o/? i t8 m7 vd16/spimiso1/gpd8 gpd8 ?/?/? o(l)/hi-z/? i t8 t4 vd17/spimosi1/gpd9 gpd9 ?/?/? o(l)/hi-z/? i t8 r5 vd18/spiclk1/gpd10 gpd10 ?/?/? o(l)/hi-z/? i t8 t5 vd19//gpd11 gpd11 ?/?/? o(l)/hi-z/? i t8 p6 vd20/ gpd12 gpd12 ?/?/? o(l)/hi-z/? i t8 r6 vd21/ gpd13 gpd13 ?/?/? o(l)/hi-z/? i t8 n7 vd22/nss1/gpd14 gpd14 ?/?/? o(l)/hi-z/? i t8 u5 vd23/nss0/gpd15 gpd15 ?/?/? o(l)/hi-z/? i t8 u16 vref vref ? ? ai ia g14 xtipll xtipll ? ? ai m26 m14 xtirtc xtirtc ? ? ai nc g15 xtopll xtopll ? ? ao m26 l12 xtortc xtortc ? ? ao nc n15 vdd_rtc vdd_rtc p p p drtc p14 vdda_adc vdda_adc p p p d33th n16 vdda_mpll vdda_mpll p p p d12t m13 vdda_upll vdda_upll p p p d12t g4 vddalive vddalive p p p d12i j17 vddalive vddalive p p p d12i
S3C2440a risc microprocessor product o verview 1- 17 table 1-2. S3C2440a 289-pin fbga pin assignments (sheet 8 of 9) (continued) pin number pin name default function i/o state @bus req i/o state @sleep i/o state @nreset i/o type a1 vddi vddi p p p d12c a10 vddi vddi p p p d12c a16 vddi vddi p p p d12c a6 vddi vddi p p p d12c b11 vddi vddi p p p d12c f1 vddi vddi p p p d12c f16 vddi vddi p p p d12c u11 vddi vddi p p p d12c l2 vddiarm vddiarm p p p d12c t6 vddiarm vddiarm p p p d12c t8 vddiarm vddiarm p p p d12c u1 vddiarm vddiarm p p p d12c j2 vddiarm vddiarm p p p d12c u2 vddiarm vddiarm p p p d12c a9 vddmop vddmop p p p d33o b12 vddmop vddmop p p p d33o b14 vddmop vddmop p p p d33o b16 vddmop vddmop p p p d33o b6 vddmop vddmop p p p d33o c1 vddmop vddmop p p p d33o f17 vddmop vddmop p p p d33o j1 vddop vddop p p p d33o t12 vddop vddop p p p d33o t3 vddop vddop p p p d33o k12 vddop vddop p p p d33o t14 vssa_adc vssa_adc p p p sth r17 vssa_mpll vssa_mpll p p p st m12 vssa_upll vssa_upll p p p st a12 vssi vssi p p p si a3 vssi vssi p p p si a4 vssi vssi p p p si b10 vssi vssi p p p si c17 vssi vssi p p p si
product overview s3c24 40a risc microprocessor 1- 18 table 1-2. S3C2440a 289-pin fbga pin assignments (sheet 9 of 9) (continued) pin number pin name default function i/o state @bus req i/o state @sleep i/o state @nreset i/o type f2 vssi vssi p p p si g17 vssi vssi p p p si h1 vssiarm vssiarm p p p si k1 vssiarm vssiarm p p p si t1 vssiarm vssiarm p p p si t2 vssiarm vssiarm p p p si u10 vssiarm vssiarm p p p si u4 vssiarm vssiarm p p p si u7 vssiarm vssiarm p p p si a11 vssmop vssmop p p p so a15 vssmop vssmop p p p so a5 vssmop vssmop p p p so a7 vssmop vssmop p p p so b1 vssmop vssmop p p p so b13 vssmop vssmop p p p so d16 vssmop vssmop p p p so d17 vssmop vssmop p p p so e2 vssmop vssmop p p p so g1 vssop vssop p p p so n1 vssop vssop p p p so u15 vssop vssop p p p so u3 vssop vssop p p p so u9 vssop vssop p p p so h11 vssop vssop p p p so notes: 1. the @bus req. shows the pin state at the external bus, which is used by the other bus master. 2. ' ? ? mark indicates the unchanged pin state at bus request mode. 3. hi-z or pre means hi-z or early state and it is determined by the setting o f misccr register. 4. ai/ao means analog input/analog output. 5. p, i, and o mean power, input and output respectively. 6. the i/o state @nreset shows the pin status in the @nreset duration below. nreset fclk @nreset 4 oscin
S3C2440a risc microprocessor product o verview 1- 19 the table below shows i/o types and descriptions. input (i)/output (o) type descriptions d12i(vdd12ih) 1.2v v dd for alive power d12c(vdd12ih_core), si(vssih) 1.2v v dd /v ss for internal logic d33o(vdd33oph), so(vssoph) 3.3v v dd /v ss for external logic d33th(vdd33th_abb),sth(vssbbh_abb) 3.3v v dd /v ss for analog circuitry d12t(vdd12t_abb), st(vssbb_abb) 1.2v v dd /v ss for analog circuitry drtc(vdd30th_rtc) 3.0v v dd for rtc power t8(phbsu100ct8sm) bi-directional pad, lvcmos schmitt-trigger, 100k w pull-up resistor with control, tri-state, io = 8ma is(phis) input pad, lvcmos schmitt-trigger level us(pbusb0) usb pad t10(phtot10cd) 5v tolerant output pad, tri-state. ot(phot8) output pad, tri-state, io = 8ma b8(phob8) output pad, io = 8ma t16(phot16sm) output pad, tri-state, medium slew rate, io = 16ma r10(phiar10_abb) analog input pad with 10 w resistor ia(phia_abb) analog input pad gp(phgpad_option) pad for analog pin m26(phsoscm26_2440a) oscillator cell with enable and feedback resistor t12(phbsu100ct12sm) bi-directional pad, lvcmos schmitt-trigger, 100k w pull-up resistor with control, tri-state, io = 12ma d8(phbsd8sm) bi-directional pad, lvcmos schmitt-trigger, open drain, io = 8ma t10s(phtot10cd_10_2440a) output pad, lvcmos, tri -state, output drive strenth control, io = 4, 6, 8, 10ma b12s(phtbsu100ct12cd_12_2440a) bi-directional pad, lvcmos schmitt-trigger, 100k w pull-up resistor with control, tri -state,output drive strenth control, io = 6, 8, 10, 12ma d2s(phtbsd2_2440a) bi-directional pad, lvcmos schmitt-trigger, open-drain, output drive strenth ignore, r50(phoar50_abb) analog output pad, 50k w resistor, separated bulk-bias t12s(phtot12cd_12_2440a) output pad, lvcmos, tri -state, output drive strenth control, io = 6, 8, 10, 12ma nc(phnc) no connection pad
product overview s3c24 40a risc microprocessor 1- 20 signal descriptions table 1-3. S3C2440a signal descriptions (sheet 1 of 6) signal input/output descriptions bus controller om[1:0] i om[1:0] sets S3C2440a in the test mode, which is used only at fabrication. also, it determines the bus width of ngcs0. the pull-up/down resistor determines the logic level during reset cycle. 00: nand-boot 01: 16-bit 10: 32-bit 11: test mode addr[26:0] o addr[26:0] (address bus) outputs the memory address of the corresponding bank . data[31:0] io data[31:0] (data bus) inputs data during memory read and outputs data during memory write. the bus width is programmable among 8/16/32-bit. ngcs[7:0] o ngcs[7:0] (general chip select) are activated when the address of a memory is within the address region of each bank. the number of access cycles and the bank size can be programmed. nwe o nwe (write enable) indicates that the current bus cycle is a write cycle. noe o noe (output enable) indicates that the current bus cycle is a read cycle. nxbreq i nxbreq (bus hold request) allows another bus master to request control of the local bus. back active indicates that bus control has been granted. nxback o nxback (bus hold acknowledge) indicates that the S3C2440a has surrendered control of the local bus to another bus master. nwait i nwait requests to prolong a current bus cycle. as long as nwait is l, the current bus cycle cannot be completed. sdram/sram nsras o sdram row address strobe nscas o sdram column address strobe nscs[1:0] o sdram chip select dqm[3:0] o sdram data mask sclk[1:0] o sdram clock scke o sdram clock enable nbe[3:0] o upper byte/lower byte enable (in case of 16-bit sram) nwbe[3:0] o write byte enable nand flash cle o command latch enable ale o address latch enable nfce o nand flash chip enable nfre o nand flash read enable nfwe o nand flash write enable ncon i nand flash configuration * if nand flash controller isn?t used, it has to be pull-up. (vddmop) frnb i nand flash ready/busy
S3C2440a risc microprocessor product o verview 1- 21 table 1-3. S3C2440a signal descriptions (sheet 2 of 6) (continued) signal input/ output descriptions lcd control unit vd[23:0] o stn/tft/sec tft: lcd data bus lcd_pwren o stn/tft/sec tft: lcd panel power enable control signal vclk o stn/tft: lcd clock signal vframe o stn: lcd frame signal vline o stn: lcd line signal vm o stn: vm alternates the polarity of the row and column voltage vsync o tft: vertical synchronous signal hsync o tft: horizontal synchronous signal vden o tft: data enable signal lend o tft: line end signal stv o sec tft: sec(samsung electronics company) tft lcd panel control signal cpv o sec tft: sec(samsung electronics company) tft lcd panel control signal lcd_hclk o sec tft: sec(samsung electronics company) tft lcd panel control signal tp o sec tft: sec(samsung electronics company) tft lcd panel control signal sth o sec tft: sec(samsung electronics company) tft lcd panel control signal lcd_lpcoe o sec tft: timing control signal for specific tft lcd lcd_lpcrev o sec tft: timing control signal for specific tft lcd lcd_lpcrevb o sec tft: timing control signal for specific tft lcd camera interface camreset o software reset to the camera camclkout o master clock to the camera campclk i pixel clock from camera camhref i horizontal sync signal from camera camvsync i vertical sync signal from camera camdata[7:0] i pixel data for ycbcr interrupt control unit eint[23:0] i external interrupt request dma nxdreq[1:0] i external dma request nxdack[1:0] o external dma acknowledge
product overview s3c24 40a risc microprocessor 1- 22 table 1-3. S3C2440a signal descriptions (sheet 3 of 6) (continued) signal input/output descriptions uart rxd[2:0] i uart receives data input txd[2:0] o uart transmits data output ncts[1:0] i uart clear to send input signal nrts[1:0] o uart request to send output signal uextclk i external clock input for uart adc ain[7:0] ai adc input[7:0]. if it isn?t used pin, it has to be low (ground). vref ai adc vref iic-bus iicsda io iic-bus data iicscl io iic-bus clock iis-bus i2slrck io iis-bus channel select clock i2ssdo o iis-bus serial data output i2ssdi i iis-bus serial data input i2ssclk io iis-bus serial clock cdclk o codec system clock ac?97 ac_sync 48khz fixed rate sample sync ac_bit_clk io 12.288mhz serial data clock ac_nreset o ac?97 master h/w reset ac_sdata_in i serial, time division multiplexed, ac?97 input stream ac_sdata_out o serial, time division multiplexed, ac?97 output stream touch screen nxpon o plus x-axis on-off control signal xmon o minus x-axis on-off control signal nypon o plus y-axis on-off control signal ymon o minus y-axis on-off control signal usb host dn[1:0] io data(?) from usb host. (need to 15k w pull-down) dp[1:0] io data(+) from usb host. (need to 15k w pull-down) usb device pdn0 io data(?) for usb peripheral. (need to 470k w pull-down for power consumption in sleep mode) pdp0 io data(+) for usb peripheral. (need to 1.5k w pull-up)
S3C2440a risc microprocessor product o verview 1- 23 table 1-3. S3C2440a signal descriptions (sheet 4 of 6) (continued) signal input/output description spi spimiso[1:0] io spimiso is the master data input line, when spi is configured as a master. when spi is configured as a slave, these pins reverse its role. spimosi[1:0] io spimosi is the master data output line, when spi is configured as a master. when spi is configured as a slave, these pins reverse its role. spiclk[1:0] io spi clock nss[1:0] i spi chip select(only for slave mode) sd sddat[3:0] io sd receive/transmit data sdcmd io sd receive response/ transmit command sdclk o sd clock general port gpn[129:0] io general input/output ports (some ports are output only) timmer/pwm tout[3:0] o timer output[3:0] tclk[1:0] i external timer clock input jtag test logic ntrst i ntrst (tap controller reset) resets the tap controller at start. if debugger is used, a 10k pull-up resistor has to be connected. if debugger (black ice) is not used, ntrst pin must be issued by a low active pulse (typically connected to nreset). tms i tms (tap controller mode select) controls the sequence of the tap controller's states. a 10k pull-up resistor has to be connected to tms pin. tck i tck (tap controller clock) provides the clock input for the jtag logic. a 10k pull-up resistor must be connected to tck pin. tdi i tdi (tap controller data input) is the serial input for test instructions and data. a 10k pull-up resistor must be connected to tdi pin. tdo o tdo (tap controller data output) is the serial output for test instructions and data.
product overview s3c24 40a risc microprocessor 1- 24 table 1-3. S3C2440a signal descriptions (sheet 5 of 6) (continued) signal input/output description reset, clock & power xtopll ao crystal output for internal osc circuit. when om[3:2] = 00b, xtipll is used for mpll clk source and upll clk source. when om[3:2] = 01b, xtipll is used for mpll clk source only. when om[3:2] = 10b, xtipll is used for upll clk source only. if it isn't used, it has to be a floating pin. mpllcap ai loop filter capacitor for main clock. upllcap ai loop filter capacitor for usb clock. xtirtc ai 32 khz crystal input for rtc. if it isn?t used, it has to be high (vddrtc). xtortc ao 32 khz crystal output for rtc. if it isn?t used, it has to be float. clkout[1:0] o clock output signal. the clksel of misccr register configures the clock output mode among the mpll clk, upll clk, fclk, hclk, pclk. nreset st nreset suspends any operation in progress and places S3C2440a into a known reset state. for a reset, nreset must be held to l level for at least 4 oscin after the processor power has been stabilized. nrstout o for external device reset control (nrstout = nreset & nwdtrst & sw_reset) pwren o 1.2v/1.3v core power on-off control signal nbatt_flt i probe for battery state(does not wake up at sleep mode in case of low battery state). if it isn?t used, it has to be high (vddop). om[3:2] i om[3:2] determines how the clock is made. om[3:2] = 00b, crystal is used for mpll clk source and upll clk source. om[3:2] = 01b, crystal is used for mpll clk source and extclk is used for upll clk source. om[3:2] = 10b, extclk is used for mpll clk source and crystal is used for upll clk source. om[3:2] = 11b, extclk is used for mpll clk source and upll clk source. extclk i external clock source. when om[3:2] = 11b, extclk is used for mpll clk source and upll clk source. when om[3:2] = 10b, extclk is used for mpll clk source only. when om[3:2] = 01b, extclk is used for upll clk source only. if it isn't used, it has to be high (vddop). xtipll ai crystal input for internal osc circuit. when om[3:2] = 00b, xtipll is used for mpll clk source and upll clk source. when om[3:2] = 01b, xtipll is used for mpll clk source only. when om[3:2] = 10b, xtipll is used for upll clk source only. if it isn't used, xtipll has to be high (vddop).
S3C2440a risc microprocessor product o verview 1- 25 table 1-3. S3C2440a signal descriptions (sheet 6 of 6) (continued) signal input/output description power vddalive p S3C2440a reset block and port status register v dd . it should be always supplied whether in normal mode or in sleep mode. vddiarm p S3C2440a core logic v dd for arm core. vddi p S3C2440a core logic v dd for internal block. vssi/vssiarm p S3C2440a core logic v ss vddi_mpll p S3C2440a mpll analog and digital v dd . vssi_mpll p S3C2440a mpll analog and digital v ss . vddop p S3C2440a i/o port vdd (3.3v) vddmop p S3C2440a memory i/o v dd 3.3v: sclk up to 135 mhz 2.5v: sclk up to 135 mhz 1.8v: sclk up to 93 mhz vssop p S3C2440a i/o port vss rtcvdd p rtc v dd (3.0v, input range: 1.8 ~ 3.6v) this pin must be connected to power properly if rtc isn't used. vddi_upll p S3C2440a upll analog and digital v dd vssi_upll p S3C2440a upll analog and digital v ss vdda_adc p S3C2440a adc v dd (3.3v) vssa_adc p S3C2440a adc v ss notes: 1. i/o means input/output. 2. ai/ao means analog input/analog output. 3. st means schmitt-trigger. 4. p means power.
product overview s3c24 40a risc microprocessor 1- 26 S3C2440a special registers table 1-4. S3C2440a special registers (sheet 1 of 14) register name address (b. endian) address (l. endian) acc. unit read/ write function memory controllers bwscon 0x48000000 w r/w bus width & wait status control bankcon0 0x48000004 boot rom control bankcon1 0x48000008 bank1 control bankcon2 0x4800000c bank2 control bankcon3 0x48000010 bank3 control bankcon4 0x48000014 bank4 control bankcon5 0x48000018 bank5 control bankcon6 0x4800001c bank6 control bankcon7 0x48000020 bank7 control refresh 0x48000024 dram/sdram refresh control banksize 0x48000028 flexible bank size mrsrb6 0x4800002c mode register set for sdram bank6 mrsrb7 0x48000030 mode register set for sdram bank7
S3C2440a risc microprocessor product o verview 1- 27 table 1-4. S3C2440a special registers (sheet 2 of 14) (continued) register name address (b. endian) address (l. endian) acc. unit read/ write function usb host controller hcrevision 0x49000000 ? w control and status group hccontrol 0x49000004 hccommonstatus 0x49000008 hcinterruptstatus 0x4900000c hcinterruptenable 0x49000010 hcinterruptdisable 0x49000014 hchcca 0x49000018 memory pointer group hcperiodcuttented 0x4900001c hccontrolheaded 0x49000020 hccontrolcurrented 0x49000024 hcbulkheaded 0x49000028 hcbulkcurrented 0x4900002c hcdonehead 0x49000030 frame counter group hcrminterval 0x49000034 hcfmremaining 0x49000038 hcfmnumber 0x4900003c hcperiodicstart 0x49000040 hclsthreshold 0x49000044 hcrhdescriptora 0x49000048 root hub group hcrhdescriptorb 0x4900004c hcrhstatus 0x49000050 hcrhportstatus1 0x49000054 hcrhportstatus2 0x49000058 interrupt controller srcpnd 0x4a000000 ? w r/w interrupt request status intmod 0x4a000004 w interrupt mode control intmsk 0x4a000008 r/w interrupt mask control priority 0x4a00000c w irq priority control intpnd 0x4a000010 r/w interrupt request status intoffset 0x4a000014 r interrupt request source offset subsrcpnd 0x4a000018 r/w sub source pending intsubmsk 0x4a00001 c r/w interrupt sub mask
product overview s3c24 40a risc microprocessor 1- 28 table 1-4. S3C2440a special registers (sheet 3 of 14) (continued) register name address (b. endian) address (l. endian) acc. unit read/ write function dma disrc0 0x4b000000 ? w r/w dma 0 initial source disrcc0 0x4b000004 dma 0 initial source control didst0 0x4b000008 dma 0 initial destination didstc0 0x4b00000c dma 0 initial destination control dcon0 0x4b000010 dma 0 control dstat0 0x4b000014 r dma 0 count dcsrc0 0x4b000018 dma 0 current source dcdst0 0x4b00001c dma 0 current destination dmasktrig0 0x4b000020 r/w dma 0 mask trigger disrc1 0x4b000040 dma 1 initial source disrcc1 0x4b000044 dma 1 initial source control didst1 0x4b000048 dma 1 initial destination didstc1 0x4b00004c dma 1 initial destination control dcon1 0x4b000050 dma 1 control dstat1 0x4b000054 r dma 1 count dcsrc1 0x4b000058 dma 1 current source dcdst1 0x4b00005c dma 1 current destination dmasktrig1 0x4b000060 r/w dma 1 mask trigger disrc2 0x4b000080 dma 2 initial source disrcc2 0x4b000084 dma 2 initial source control didst2 0x4b000088 dma 2 initial destination didstc2 0x4b00008c dma 2 initial destination control dcon2 0x4b000090 dma 2 control dstat2 0x4b000094 r dma 2 count dcsrc2 0x4b000098 dma 2 current source dcdst2 0x4b00009c dma 2 current destination dmasktrig2 0x4b0000a0 r/w dma 2 mask trigger disrc3 0x4b0000c0 ? w r/w dma 3 initial source disrcc3 0x4b0000c4 dma 3 initial source control didst3 0x4b0000c8 dma 3 initial destination didstc3 0x4b0000cc dma 3 initial destination control dcon3 0x4b0000d0 dma 3 control dstat3 0x4b0000d4 r dma 3 count dcsrc3 0x4b0000d8 dma 3 current source dcdst3 0x4b0000dc dma 3 current destination dmasktrig3 0x4b0000e0 r/w dma 3 mask trigger
S3C2440a risc microprocessor product o verview 1- 29 table 1-4. S3C2440a special registers (sheet 4 of 14) (continued) register name address (b. endian) address (l. endian) acc. unit read/ write function clock & power management locktime 0x4c000000 ? w r/w pll lock time counter mpllcon 0x4c000004 mpll control upllcon 0x4c000008 upll control clkcon 0x4c00000c clock generator control clkslow 0x4c000010 slow clock control clkdivn 0x4c000014 clock divider control camdivn 0x4c000018 camera clock divider control lcd controller lcdcon1 0x4d000000 ? w r/w lcd control 1 lcdcon2 0x4d000004 lcd control 2 lcdcon3 0x4d000008 lcd control 3 lcdcon4 0x4d00000c lcd control 4 lcdcon5 0x4d000010 lcd control 5 lcdsaddr1 0x4d000014 stn/tft: frame buffer start address 1 lcdsaddr2 0x4d000018 stn/tft: frame buffer start address 2 lcdsaddr3 0x4d00001c stn/tft: virtual screen address set redlut 0x4d000020 stn: red lookup table greenlut 0x4d000024 stn: green lookup table bluelut 0x4d000028 stn: blue lookup table dithmode 0x4d00004c stn: dithering mode tpal 0x4d000050 tft: temporary palette lcdintpnd 0x4d000054 lcd interrupt pending lcdsrcpnd 0x4d000058 lcd interrupt source lcdintmsk 0x4d00005c lcd interrupt mask tconsel 0x4d000060 tcon(lpc3600/lcc3600) control
product overview s3c24 40a risc microprocessor 1- 30 table 1-4. S3C2440a special registers (sheet 5 of 14) (continued) register name address (b. endian) address (l. endian) acc. unit read/ write function nand flash nfconf 0x4e000000 ? w r/w nand flash configuration nfcont 0x4e000004 nand flash control nfcmd 0x4e000008 nand flash command nfaddr 0x4e00000c nand flash address nfdata 0x4e000010 nand flash data nfmecc0 0x4e000014 nand flash main area ecc0/1 nfmecc1 0x4e000018 nand flash main area ecc2/3 nfsecc 0x4e00001c nand flash spare area ecc nfstat 0x4e000020 nand flash operation status nfestat0 0x4e000024 nand flash ecc status for i/o[7:0] nfestat1 0x4e000028 nand flash ecc status for i/o[15:8] nfmecc0 0x4e00002c r nand flash main area ecc0 status nfmecc1 0x4e000030 nand flash main area ecc1 status nfsecc 0x4e000034 nand flash spare area ecc status nfsblk 0x4e000038 r/w nand flash start block address nfeblk 0x4e00003c nand flash end block address
S3C2440a risc microprocessor product o verview 1- 31 table 1-4. S3C2440a special registers (sheet 6 of 14) (continued) register name address (b. endian) address (l. endian) acc. unit read/ write function camera interface cisrcfmt 0x4f000000 ? w rw input source format ciwdofst 0x4f000004 window offset register cigctrl 0x4f000008 global control register cicoysa1 0x4f000018 y 1 st frame start address for codec dma cicoysa2 0x4f00001c y 2 nd frame start address for codec dma cicoysa3 0x4f000020 y 3 nd frame start address for codec dma cicoysa4 0x4f000024 y 4 th frame start address for codec dma cicocbsa1 0x4f000028 cb 1 st frame start address for codec dma cicocbsa2 0x4f00002c cb 2 nd frame start address for codec dma cicocbsa3 0x4f000030 cb 3 nd frame start address for codec dma cicocbsa4 0x4f000034 cb 4 th frame start address for codec dma cicocrsa1 0x4f000038 cr 1 st frame start address for codec dma cicocrsa2 0x4f00003c cr 2 nd frame start address for codec dma cicocrsa3 0x4f000040 cr 3 nd frame start address for codec dma cicocrsa4 0x4f000044 cr 4 th frame start address for codec dma cicotrgfmt 0x4f000048 target image format of codec dma cicoctrl 0x4f00004c codec dma control related cicoscpreratio 0x4f000050 codec pre-scaler ratio control cicoscpredst 0x4f000054 codec pre-scaler destination format cicoscctrl 0x4f000058 codec main-scaler control cicotarea 0x4f00005c codec scaler target area cicostatus 0x4f000064 codec path status ciprclrsa1 0x4f00006c rgb 1 st frame start address for preview dma ciprclrsa2 0x4f000070 rgb 2 nd frame start address for preview dma ciprclrsa3 0x4f000074 rgb 3 nd frame start address for preview dma ciprclrsa4 0x4f000078 rgb 4 th frame start address for preview dma ciprtrgfmt 0x4f00007c target image format of preview dma ciprctrl 0x4f000080 preview dma control related ciprscpreratio 0x4f000084 preview pre-scaler ratio control ciprscpredst 0x4f000088 preview pre-scaler destination format ciprscctrl 0x4f00008c preview main-scaler control ciprtarea 0x4f000090 preview scaler target area ciprstatus 0x4f000098 preview path status ciimgcpt 0x4f0000a0 image capture enable command
product overview s3c24 40a risc microprocessor 1- 32 table 1-4. S3C2440a special registers (sheet 7 of 14) (continued) register name address (b. endian) address (l. endian) acc. unit read/ write function uart ulcon0 0x50000000 ? w r/w uart 0 line control ucon0 0x50000004 uart 0 control ufcon0 0x50000008 uart 0 fifo control umcon0 0x5000000c uart 0 modem control utrstat0 0x50000010 r uart 0 tx/rx status uerstat0 0x50000014 uart 0 rx error status ufstat0 0x50000018 uart 0 fifo status umstat0 0x5000001c uart 0 modem status utxh0 0x50000023 0x50000020 b w uart 0 transmission hold urxh0 0x50000027 0x50000024 r uart 0 receive buffer ubrdiv0 0x50000028 ? w r/w uart 0 baud rate divisor ulcon1 0x50004000 uart 1 line control ucon1 0x50004004 uart 1 control ufcon1 0x50004008 uart 1 fifo control umcon1 0x5000400c uart 1 modem control utrstat1 0x50004010 r uart 1 tx/rx status uerstat1 0x50004014 uart 1 rx error status ufstat1 0x50004018 uart 1 fifo status umstat1 0x5000401c uart 1 modem status utxh1 0x50004023 0x50004020 b w uart 1 transmission hold urxh1 0x50004027 0x50004024 r uart 1 receive buffer ubrdiv1 0x50004028 ? w r/w uart 1 baud rate divisor ulcon2 0x50008000 uart 2 line control ucon2 0x50008004 uart 2 control ufcon2 0x50008008 uart 2 fifo control utrstat2 0x50008010 r uart 2 tx/rx status uerstat2 0x50008014 uart 2 rx error status ufstat2 0x50008018 uart 2 fifo status utxh2 0x50008023 0x50008020 b w uart 2 transmission hold urxh2 0x50008027 0x50008024 r uart 2 receive buffer ubrdiv2 0x50008028 ? w r/w uart 2 baud rate divisor
S3C2440a risc microprocessor product o verview 1- 33 table 1-4. S3C2440a special registers (sheet 8 of 14) (continued) register name address (b. endian) address (l. endian) acc. unit read/ write function pwm timer tcfg0 0x51000000 ? w r/w timer configuration tcfg1 0x51000004 timer configuration tcon 0x51000008 timer control tcntb0 0x5100000c timer count buffer 0 tcmpb0 0x51000010 timer compare buffer 0 tcnto0 0x51000014 r timer count observation 0 tcntb1 0x51000018 r/w timer count buffer 1 tcmpb1 0x5100001c timer compare buffer 1 tcnto1 0x51000020 r timer count observation 1 tcntb2 0x51000024 r/w timer count buffer 2 tcmpb2 0x51000028 timer compare buffer 2 tcnto2 0x5100002c r timer count observation 2 tcntb3 0x51000030 r/w timer count buffer 3 tcmpb3 0x51000034 timer compare buffer 3 tcnto3 0x51000038 r timer count observation 3 tcntb4 0x5100003c r/w timer count buffer 4 tcnto4 0x51000040 r timer count observation 4
product overview s3c24 40a risc microprocessor 1- 34 table 1-4. S3C2440a special registers (sheet 9 of 14) (continued) register name address (b. endian) address (l. endian) acc. unit read/ write function usb device func_addr_reg 0x52000143 0x52000140 b r/w function address pwr_reg 0x52000147 0x52000144 power management ep_int_reg 0x5200014b 0x52000148 ep interrupt pending and clear usb_int_reg 0x5200015b 0x52000158 usb interrupt pending and clear ep_int_en_reg 0x5200015f 0x5200015c interrupt enable usb_int_en_reg 0x5200016f 0x5200016c interrupt enable frame_num1_reg 0x52000173 0x52000170 r frame number lower byte frame_num2_reg 0x52000177 0x52000174 frame number higher byte index_reg 0x5200017b 0x52000178 r/w register index ep0_csr 0x52000187 0x52000184 endpoint 0 status in_csr1_reg 0x52000187 0x52000184 in endpoint control status in_csr2_reg 0x5200018b 0x52000188 in endpoint control status maxp_reg 0x52000183 0x52000180 endpoint max packet out_csr1_reg 0x52000193 0x52000190 out endpoint control status out_csr2_reg 0x52000197 0x52000194 out endpoint control status out_fifo_cnt1_reg 0x5200019b 0x52000198 r endpoint out write count out_fifo_cnt2_reg 0x5200019f 0x5200019c endpoint out write count ep0_fifo 0x520001c3 0x520001c0 r/w endpoint 0 fifo ep1_fifo 0x520001c7 0x520001c4 endpoint 1 fifo ep2_fifo 0x520001cb 0x520001c8 endpoint 2 fifo ep3_fifo 0x520001cf 0x520001cc endpoint 3 fifo ep4_fifo 0x520001d3 0x520001d0 endpoint 4 fifo ep1_dma_con 0x52000203 0x52000200 ep1 dma interface control ep1_dma_unit 0x52000207 0x52000204 ep1 dma tx unit counter ep1_dma_fifo 0x5200020b 0x52000208 ep1 dma tx fifo counter ep1_dma_ttc_l 0x5200020f 0x5200020c ep1 dma total tx counter ep1_dma_ttc_m 0x52000213 0x52000210 ep1 dma total tx counter ep1_dma_ttc_h 0x52000217 0x52000214 ep1 dma total tx counter ep2_dma_con 0x5200021b 0x52000218 b r/w ep2 dma interface control ep2_dma_unit 0x5200021f 0x5200021c ep2 dma tx unit counter ep2_dma_fifo 0x52000223 0x52000220 ep2 dma tx fifo counter ep2_dma_ttc_l 0x52000227 0x52000224 ep2 dma total tx counter ep2_dma_ttc_m 0x5200022b 0x52000228 ep2 dma total tx counter
S3C2440a risc microprocessor product o verview 1- 35 table 1-4. S3C2440a special registers (sheet 10 of 14) (continued) register name address (b. endian) address (l. endian) acc. unit read/ write function usb device (continued) ep2_dma_ttc_h 0x5200022f 0x5200022c ep2 dma total tx counter ep3_dma_con 0x52000243 0x52000240 ep3 dma interface control ep3_dma_unit 0x52000247 0x52000244 ep3 dma tx unit counter ep3_dma_fifo 0x5200024b 0x52000248 ep3 dma tx fifo counter ep3_dma_ttc_l 0x5200024f 0x5200024c ep3 dma total tx counter ep3_dma_ttc_m 0x52000253 0x52000250 ep3 dma total tx counter ep3_dma_ttc_h 0x52000257 0x52000254 ep3 dma total tx counter ep4_dma_con 0x5200025b 0x52000258 ep4 dma interface control ep4_dma_unit 0x5200025f 0x5200025c ep4 dma tx unit counter ep4_dma_fifo 0x52000263 0x52000260 ep4 dma tx fifo counter ep4_dma_ttc_l 0x52000267 0x52000264 ep4 dma total tx counter ep4_dma_ttc_m 0x5200026b 0x52000268 ep4 dma total tx counter ep4_dma_ttc_h 0x5200026f 0x5200026c ep4 dma total tx counter watchdog timer wtcon 0x53000000 ? w r/w watchdog timer mode wtdat 0x53000004 watchdog timer data wtcnt 0x53000008 watchdog timer count iic iiccon 0x54000000 ? w r/w iic control iicstat 0x54000004 iic status iicadd 0x54000008 iic address iicds 0x5400000c iic data shift iiclc 0x54000010 iic multi-master line control iis iiscon 0x55000000,02 0x55000000 hw,w r/w iis control iismod 0x55000004,06 0x55000004 iis mode iispsr 0x55000008,0a 0x55000008 iis prescaler iisfcon 0x5500000c,0e 0x5500000c iis fifo control iisfifo 0x55000012 0x55000010 hw iis fifo entry
product overview s3c24 40a risc microprocessor 1- 36 table 1-4. S3C2440a special registers (sheet 11 of 14) (continued) register name address (b. endian) address (l. endian) acc. unit read/ write function i/o port gpacon 0x56000000 ? w r/w port a control gpadat 0x56000004 port a data gpbcon 0x56000010 port b control gpbdat 0x56000014 port b data gpbup 0x56000018 pull-up control b gpccon 0x56000020 port c control gpcdat 0x56000024 port c data gpcup 0x56000028 pull-up control c gpdcon 0x56000030 port d control gpdda1t 0x56000034 port d data gpdup 0x56000038 pull-up control d gpecon 0x56000040 port e control gpedat 0x56000044 port e data gpeup 0x56000048 pull-up control e gpfcon 0x56000050 port f control gpfdat 0x56000054 port f data gpfup 0x56000058 pull-up control f gpgcon 0x56000060 port g control gpgdat 0x56000064 port g data gpgup 0x56000068 pull-up control g gphcon 0x56000070 port h control gphdat 0x56000074 port h data gphup 0x56000078 pull-up control h gpjcon 0x560000d0 port j control gpjdat 0x560000d4 port j data gpjup 0x560000d8 pull-up control j misccr 0x56000080 miscellaneous control dclkcon 0x56000084 dclk0/1 control extint0 0x56000088 external interrupt control register 0 extint1 0x5600008c external interrupt control register 1 extint2 0x56000090 external interrupt control register 2
S3C2440a risc microprocessor product o verview 1- 37 table 1-4. S3C2440a special registers (sheet 12 of 14) (continued) register name address (b. endian) address (l. endian) acc. unit read/ write function i/o port (continued) eintflt0 0x56000094 ? w r/w reserved eintflt1 0x56000098 reserved eintflt2 0x5600009c external interrupt filter control register 2 eintflt3 0x560000a0 external interrupt filter control register 3 eintmask 0x560000a4 external interrupt mask eintpend 0x560000a8 external interrupt pending gstatus0 0x560000ac r external pin status gstatus1 0x560000b0 r/w chip id gstatus2 0x560000b4 reset status gstatus3 0x560000b8 inform register gstatus4 0x560000bc inform register mslcon 0x560000cc memory sleep control register rtc rtccon 0x57000043 0x57000040 b r/w rtc control ticnt 0x57000047 0x57000044 tick time count rtcalm 0x57000053 0x57000050 rtc alarm control almsec 0x57000057 0x57000054 alarm second almmin 0x5700005b 0x57000058 alarm minute almhour 0x5700005f 0x5700005c alarm hour almdate 0x57000063 0x57000060 alarm day almmon 0x57000067 0x57000064 alarm month almyear 0x5700006b 0x57000068 alarm year bcdsec 0x57000073 0x57000070 bcd second bcdmin 0x57000077 0x57000074 bcd minute bcdhour 0x5700007b 0x57000078 bcd hour bcddate 0x5700007f 0x5700007c bcd day bcdday 0x57000083 0x57000080 bcd date bcdmon 0x57000087 0x57000084 bcd month bcdyear 0x5700008b 0x57000088 bcd year
product overview s3c24 40a risc microprocessor 1- 38 table 1-4. S3C2440a special registers (sheet 13 of 14) (continued) register name address (b. endian) address (l. endian) acc. unit read/ write function a/d converter adccon 0x58000000 ? w r/w adc control adctsc 0x58000004 adc touch screen control adcdly 0x58000008 adc start or interval delay adcdat0 0x5800000c r adc conversion data adcdat1 0x58000010 adc conversion data adcupdn 0x58000014 r/w stylus up or down interrupt status spi spcon0,1 0x59000000,20 ? w r/w spi control spsta0,1 0x59000004,24 r spi status sppin0,1 0x59000008,28 r/w spi pin control sppre0,1 0x5900000c,2c spi baud rate prescaler sptdat0,1 0x59000010,30 spi tx data sprdat0,1 0x59000014,34 r spi rx data sd interface sdicon 0x5a000000 ? w r/w sdi control sdipre 0x5a000004 sdi baud rate prescaler sdicarg 0x5a000008 sdi command argument sdiccon 0x5a00000c sdi command control sdicsta 0x5a000010 r/(c) sdi command status sdirsp0 0x5a000014 r sdi response sdirsp1 0x5a000018 sdi response sdirsp2 0x5a00001c sdi response sdirsp3 0x5a000020 sdi response sdidtimer 0x5a000024 r/w sdi data / busy timer sdibsize 0x5a000028 sdi block size sdidcon 0x5a00002c sdi data control sdidcnt 0x5a000030 r sdi data remain counter sdidsta 0x5a000034 r/(c) sdi data status sdifsta 0x5a000038 r sdi fifo status sdiimsk 0x5a00003c ? w sdi interrupt mask sdidat 0x5a000043 0x5a000040 b r/w sdi data
S3C2440a risc microprocessor product o verview 1- 39 table 1-4. S3C2440a special registers (sheet 14 of 14) (continued) register name address (b. endian) address (l. endian) acc. unit read/ write function ac97 audio-codec interface ac_glbctrl 0x5b000000 ? w r/w ac97 global control register ac_glbstat 0x5b000004 r ac97 global status register ac_codec_cmd 0x5b000008 r/w ac97 codec command register ac_codec_stat 0x5b00000c r ac97 codec status register ac_pcmaddr 0x5b000010 ac97 pcm out/in channel fifo address register ac_micaddr 0x5b000014 ac97 mic in channel fifo address register ac_pcmdata 0x5b000018 r/w ac97 pcm out/in channel fifo data register ac_micdata 0x5b00001c ac97 mic in channel fifo data register cautions on S3C2440a special registers 1. in the little endian mode ?l?, endian address must be used. in the big endian mode ?b? endian address must be used. 2. the special registers have to be accessed for each recommended access unit. 3. all registers except adc registers, rtc registers and uart registers must be read/write in word unit (32-bit) in little/big endian. 4. make sure that the adc registers, rtc registers and uart registers be read/write by the specified access unit and the specified address. moreover, one must carefully consider which endian mode is used. 5. w : 32-bit register, which must be accessed by ldr/str or int type pointer (int *). hw : 16-bit register, which must be accessed by ldrh/strh or short int type pointer (short int *). b : 8-bit register, which must be accessed by ldrb/strb or char type pointer (char int *).
S3C2440a risc microp rocessor programmer 's model 2 - 1 2 programmer's model overview S3C2440a is developed using the advanced arm920t core, which has been designed by advanced risc machines, ltd. processor operating states from the programmer's point of view, the arm920t can be in one of the two states: arm state which executes 32 - bit, word - aligned arm instructions thumb state is a state which can execute 16 - bit, halfword - aligned thumb instructions. in this state, the pc uses bit 1 to select between alternate halfwords note transition between these two states does not affect the processor mode or the contents of the registers. switching state entering thumb state entry into thumb state can be achieved by executing a bx instruction with the state bit (bit 0) set in the oper and register. transition to thumb state will also occur automatically on return from an exception (irq, fiq, undef, abort, swi etc.), if the exception is entered with the processor in thumb state. entering arm state entry into arm state can be done by the following methods: - on execution of the bx instruction with the state bit clear in the operand register. on the pr ocessor taking an exception (irq, fiq, reset, undef, abort, swi etc.). in this case, the pc is placed in the exception mode's link register, and execution commences at the exception's vector address. memory formats arm920t views memory as a linear collecti on of bytes numbered upwards from zero. bytes 0 to 3 hold the first stored word, bytes 4 to 7 the second and so on. arm920t can treat words in memory as being stored either in big - endian or little - endian format.
programmer's model S3C2440a risc micro processor 2 - 2 big - endian format in big - endian format, the most significant byte of a word is stored at the lowest numbered byte and the least significant byte at the highest numbered byte. byte 0 of the memory system is therefore connected to data lines 31 through 24. 31 24 8 4 0 23 16 9 5 1 10 6 2 11 7 3 15 8 7 0 4 0 8 higher address lower address word address most significant byte is at lowest address word is addressed by byte address of most significant byte figure 2 - 1. big - endian addresses of bytes within words little - endian format in little - endian format, the lowest numbered byte in a word is considered the word's least significant byte, and the highest numbered byte the most significant. byte 0 of the memory system is th erefore connected to data lines 7 through 0. 31 24 11 7 3 23 16 10 6 2 9 5 1 8 4 0 15 8 7 0 4 0 8 higher address lower address word address least significant byte is at lowest address word is addressed by byte address of least significant byte figure 2 - 2. little - endian addresses of bytes within words instruction length instructions are either 32 bits long (in arm state) or 16 bits long (in thumb state). data types arm920t supports byte (8 - bit), halfword (16 - bit) and word (32 - bit) data types. words must be aligned to four - byte boundaries and half words to two - byte bo undaries.
S3C2440a risc microp rocessor programmer 's model 2 - 3 operating modes arm920t supports seven modes of operation: user (usr): the normal arm program execution state fiq (fiq): designed to support a data transfer or channel process irq (irq): used for general - purpose interrupt handling supervisor (svc): protected mode for the operating system abort mode (abt): entered after a data or instruction prefetch abort system (sys): a privileged user mode for the operating system undefined (und): entered when an undefined instruction is executed mode changes can be made using the control of software, or may be brought about by external interrupts or exception processing. most application programs will execute in user mode. the non - user modes' know n as privileged modes - are entered in order to service interrupts or exceptions, or to access protected resources. registers arm920t has a total of 37 registers - 31 general - purpose 32 - bit registers and six status registers - but these cannot all be seen a t once. the processor state and operating mode decides which registers are available to the programmer. the arm state register set in arm state, 16 general registers and one or two status registers are visible at any one time. in privil eged (non - user) modes, mode - specific banked registers are switched in. figure 2 - 3 shows which register is available in each mode: the banked registers are marked with a shaded triangle. the arm state register set contains 16 directly accessible registers: r0 to r15. all of these except r15 are general - purpose, and may be used to hold either data or address values. in addition to these, there is a seventeenth register used to store status information. register 14 this register is used as the subroutine link register. this receives a copy of r15 when a branch and link (bl) instruction is executed. rest of the time it may be treated as a general - purpose register. the corresponding banked registers r14_svc, r14_irq, r14_fiq, r14_abt and r14_und are similarly use d to hold the return values of r15 when interrupts and exceptions arise, or when branch and link instructions are executed within interrupt or exception routines. register 15 this register holds the program counter (pc). in arm state, bits [1:0] of r15 ar e zero and bits [31:2] contain the pc. in thumb state, bit [0] is zero and bits [31:1] contain the pc. register 16 this register is the cpsr (current program status register). this contains condition code flags and the current mode bits. fiq mode has s even banked registers mapped to r8 - 14 (r8_fiq - r14_fiq). in arm state there are many fiq handlers which don?t require saving registers. user, irq, supervisor, abort and undefined, each have two banked registers mapped to r13 and r14, allowing each of these modes to have a private stack pointer and link registers.
programmer's model S3C2440a risc micro processor 2 - 4 r0 r1 r2 r3 r4 r5 r6 r7 r9 r8 r10 r11 r12 r13 r14 r15 (pc) r0 r1 r2 r3 r4 r5 r6 r7 r9 r8 r10 r11 r12 r13_ svc r14_ svc r15 (pc) r0 r1 r2 r3 r4 r5 r6 r7 r9_ fiq r10_ fiq r11_ fiq r12_ fiq r13_ fiq r14_ fiq r15 (pc) r8_ fiq r0 r1 r2 r3 r4 r5 r6 r7 r9 r8 r10 r11 r12 r13_ abt r14_ abt r15 (pc) r0 r1 r2 r3 r4 r5 r6 r7 r9 r8 r10 r11 r12 r13_ irq r14_ irq r15 (pc) r0 r1 r2 r3 r4 r5 r6 r7 r9 r8 r10 r11 r12 r13_ und r14_ und r15 (pc) system & user fiq supervisor irq abort undefined arm state general registers and program counter arm state program status registers cpsr cpsr spsr_ fiq cpsr spsr_ svc cpsr spsr_ abt cpsr spsr_ irq cpsr spsr_ und = banked register figure 2 - 3. register organization in arm state
S3C2440a risc microp rocessor programmer 's model 2 - 5 the thumb state register set the thumb state register set is a subset of the arm state set. the programmer has direct ac cess to eight general registers, r0 - r7, as well as the program counter (pc), a stack pointer register (sp), a link register (lr), and the cpsr. there are banked stack pointers, link registers and saved process status registers (spsrs) for each privileged m ode. this is shown in figure 2 - 4. r0 r1 r2 r3 r4 r5 r6 r7 lr sp pc system & user fiq supervisor irq abort undefined thumb state general registers and program counter thumb state program status registers cpsr cpsr spsr_ fiq cpsr spsr_ svc cpsr spsr_ abt cpsr spsr_ irq cpsr spsr_ und = banked register lr_ fiq r0 r1 r2 r3 r4 r5 r6 r7 sp_ fiq pc lr_ svc r0 r1 r2 r3 r4 r5 r6 r7 sp_ svc pc lr_ und r0 r1 r2 r3 r4 r5 r6 r7 sp_ und pc lr_ fiq r0 r1 r2 r3 r4 r5 r6 r7 sp_ fiq pc lr_ abt r0 r1 r2 r3 r4 r5 r6 r7 sp_ abt pc figure 2 - 4. register organization in thumb state
programmer's model S3C2440a risc micro processor 2 - 6 the relationship between arm and thumb state registers the relationship between arm and thumb state registers are as below: - thumb state r0 - r7 and arm state r0 - r7 are identical thumb state cpsr and spsrs and arm state cpsr and spsrs are identical thumb state sp maps onto arm state r13 thumb state lr maps onto arm state r14 the thumb state program counter maps onto the arm state program counter (r15) this relationship is shown in figure 2 - 5. thumb state (cpsr) (spsr) stack pointer (r13) link register (r14) program counter (r15) r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 (cpsr) (spsr) stack pointer (sp) link register (lr) program counter (pc) r0 r1 r2 r3 r4 r5 r6 r7 arm state lo-registers hi-registers figure 2 - 5 . mapping of thumb state registers onto arm state registers
S3C2440a risc microp rocessor programmer 's model 2 - 7 accessing hi - registers in thumb state in thumb state, registers r8 - r15 ("hi registers") are not part of the standard register set. however, the assemb ly language programmer has limited access to them, and can use them for fast temporary storage. a value may be transferred from a register in the range r0 - r7 (a lo register) to a hi register and from a hi register to a lo register, using special variants of the mov instruction. hi register values can also be compared against or added to lo register values with the cmp and add instructions. for more information, please refer to figure 3 - 34. the program status r egisters the arm920t contains a current program status register (cpsr), plus five saved program status registers (spsrs) for use by exception handlers. these register's functions are: hold information about the most recently performed alu operation control the enabling and disabling of interrupts set the processor operating mode the arrangement of bits is shown in figure 2 - 6. 31 condition code flags overflow n z c v i f t m4 m3 m2 m1 m0 30 29 27 28 26 25 24 23 8 7 6 5 4 3 2 1 0 (resverved) control bits carry/borrow/extend zero negative/less than mode bits state bits fiq disable irq disable ~ ~ ~ ~ figure 2 - 6. program status register format
programmer's model S3C2440a risc micro processor 2 - 8 the condition code flags the n, z, c and v bits are the condition code flags. these may be changed as a result of arithmetic and logical operations, and may be tested to determine whether an instruction should be ex ecuted. in arm state, all instructions may be executed conditionally: see table 3 - 2 for details. in thumb state, only the branch instruction is capable of conditional execution: see figure 3 - 46 for details. the control bits the bottom 8 bits of a psr (in corporating i, f, t and m[4:0]) are known collectively as the control bits. these will be changed when an exception arises. if the processor is operating in a privileged mode, they can also be manipulated by software. the t bit this reflects the operating state. when this bit is set, the processor is executed in thumb state, or otherwise it is executing in arm state. this is reflected on the tbit external signal. note: that the software must never change the state of the tbit in the cpsr. if this happens, the processor will enter an unpredictable state. interrupt disable bits i and f bits are the interrupt disable bits. when set, these disable the irq and fiq interrupts respectively. the mode bits the m4, m3, m2, m1 and m0 bits (m[4:0]) are t he mode bits. these determine the processor's operating mode, as shown in table 2 - 1. not all combinations of the mode bits define a valid processor mode. only those explicitly described shall be used. the user should be aware that if any illegal value is programmed into the mode bits, m[4:0], then the processor will enter an unrecoverable state. if this occurs, reset should be applied. reserved bits the remaining bits in the psrs are reserved. when changing a psr's flag or control bits, you must ensure that these unused bits are not altered. also, your program should not rely on them containing specific values, since in future processors they may read as one or zero.
S3C2440a risc microp rocessor programmer 's model 2 - 9 table 2 - 1. psr mode bit values m[4:0] mode visible thumb state registers visible arm state registers 10000 user r7..r0, lr, sp pc, cpsr r14..r0, pc, cpsr 10001 fiq r7..r0, lr_fiq, sp_fiq pc, cpsr, spsr_fiq r7..r0, r14_fiq..r8_fiq, pc, cpsr, spsr_fiq 10010 irq r7..r0, lr_irq, sp_irq pc, cpsr, spsr_irq r12..r0, r14_irq, r13_irq, pc, cpsr, spsr_irq 10011 supervisor r7..r0, lr_svc, sp_svc, pc, cpsr, spsr_svc r12..r0, r14_svc, r13_svc, pc, cpsr, spsr_svc 10111 abort r7..r0, lr_abt, sp_abt, pc, cpsr, spsr_abt r12..r0, r14_abt, r13_abt, p c, cpsr, spsr_abt 11011 undefined r7..r0 lr_und, sp_und, pc, cpsr, spsr_und r12..r0, r14_und, r13_und, pc, cpsr 11111 system r7..r0, lr, sp pc, cpsr r14..r0, pc, cpsr reserved bits the remaining bits in the psr's are reserved. while changing a psr's fl ag or control bits, you must ensure that these unused bits are not altered. also, your program should not rely on them containing specific values, since in future processors they may read as one or zero.
programmer's model S3C2440a risc micro processor 2 - 10 exceptions exceptions arise whenever the n ormal flow of a program has to be halted temporarily, for example to service an interrupt from a peripheral. before an exception can be handled, the current processor state must be preserved so that the original program can resume when the handler routine has finished. it is possible for several exceptions to arise at the same time. if this happens, they are dealt with in a fixed order. see exception priorities on page 2 - 14. action on entering an exception while handling an excepti on, the arm920t does following activities: 1. preserves the address of the next instruction in the appropriate link register. if the exception has been entered from arm state, then the address of the next instruction is copied into the link register (that is, current pc + 4 or pc + 8 depending on the exception. see table 2 - 2 on for details). if the exception has been entered from thumb state, then the value written into the link register is the current pc offset by a value such that the program resumes fro m the correct place on return from the exception. this means that the exception handler need not determine which state the exception was entered from. for example, in the case of swi, movs pc, r14_svc will always return to the next instruction regardless o f whether the swi was executed in arm or thumb state. 2. copies the cpsr into the appropriate spsr 3. forces the cpsr mode bits to a value which depends on the exception 4. forces the pc to fetch the next instruction from the relevant exception vector it m ay also set the interrupt disable flags to prevent otherwise unmanageable nestings of exceptions. if the processor is in thumb state when an exception occurs, it will automatically switch into arm state when the pc is loaded with the exception vector addre ss. action on leaving an exception on completion, the exception handler: 1. moves the link register, minus an offset where appropriate, to the pc. (the offset will vary depending on the type of exception.) 2. copies the spsr back t o the cpsr 3. clears the interrupt disable flags, if they were set on entry note an explicit switch back to thumb state is never needed, since restoring the cpsr from the spsr automatically sets the t bit to t he value it held immediately prior to the exception.
S3C2440a risc microp rocessor programmer 's model 2 - 11 exception entry/exit summary table 2 - 2 summarizes the pc value preserved in the relevant r14 on exception entry, and the recommended instruction for exiting the exception handler. table 2 - 2. exception e ntry/exit return instruction previous state notes arm r14_x thumb r14_x bl mov pc, r14 pc + 4 pc + 2 (1) swi movs pc, r14_svc pc + 4 pc + 2 (1) udef movs pc, r14_und pc + 4 pc + 2 (1) fiq subs pc, r14_fiq, #4 pc + 4 pc + 4 (2) irq subs pc, r14_irq , #4 pc + 4 pc + 4 (2) pabt subs pc, r14_abt, #4 pc + 4 pc + 4 (1) dabt subs pc, r14_abt, #8 pc + 8 pc + 8 (3) reset na ? ? (4) notes: 1. where pc is the address of the bl/swi/undefined instruction fetch which had the prefetch abort. 2. where pc is the address of the instruction which did not get executed since the fiq or irq took priority. 3. where pc is the address of the load or store instruction which generated the data abort. 4. the value saved in r14_svc upon reset is unpredictable. fiq the fiq ( fast interrupt request) exception is designed to support a data transfer or channel process, and in arm state has sufficient private registers to remove the need for register saving (thus minimizing the overhead of context switching). fiq is externally gen erated by taking the nfiq input low. this input can except either synchronous or asynchronous transitions, depending on the state of the isync input signal. when isync is low, nfiq and nirq are considered asynchronous, and a cycle delay for synchronization is incurred before the interrupt can affect the processor flow. irrespective of whether the exception was entered from arm or thumb state, a fiq handler should leave the interrupt by executing subs pc,r14_fiq,#4 fiq may be disabled by setting the cpsr's f flag (but note that this is not possible from user mode). if the f flag is clear, arm920t checks for a low level on the output of the fiq synchronizer at the end of each instruction.
programmer's model S3C2440a risc micro processor 2 - 12 irq the irq (interrupt request) exceptio n is a normal interrupt caused by a low level on the nirq input. irq has a lower priority than fiq and is masked out when a fiq sequence is entered. it may be disabled at any time by setting i bit in the cpsr, though this can only be done from a privileged (non - user) mode. irrespective of whether the exception was entered from arm or thumb state, an irq handler should return from the interrupt by executing subs pc,r14_irq,#4 abort an abort indicates that the current memory access cannot be completed. it ca n be signaled by the external abort input. arm920t checks for the abort exception during memory access cycles. there are two types of abort: prefetch abort: occurs during an instruction prefetch. data abort: occurs during a data access. if a prefetch abort occurs, the prefetched instruction is marked as invalid, but the exception will not be taken until the instruction reaches the head of the pipeline. if the instruction is not executed ? the abort doesn?t take place because a branch occurs while it is in the pipeline - . if a data abort occurs, the action taken depends on the instruction type: single data transfer instruc tions (ldr, str) write back modified base registers: the abort handler must be aware of this. the swap instruction (swp) is aborted as though it had not been executed. block data transfer in structions (ldm, stm) complete. if write - back is set, the base is updated. if the instruction would have overwritten the base with data (ie it has the base in the transfer list), the overwriting is prevented. all register overwriting is prevented after an abort is indicated, which means in particular that r15 (always the last register to be transferred) is preserved in an aborted ldm instruction. the abort mechanism allows the implementation of a demand paged virtual memory syst em. in such a system the processor is allowed to generate arbitrary addresses. when the data at an address is unavailable, the memory management unit (mmu) signals an abort. the abort handler must then work out the cause of the abort, make the requested da ta available, and retry the aborted instruction. the application program needs no knowledge of the amount of memory available to it, nor is its state in any way affected by the abort. after fixing the reason for the abort, the handler should execute the fo llowing irrespective of the state (arm or thumb): subs pc,r14_abt,#4 ; for a prefetch abort, or subs pc,r14_abt,#8 ; for a data abort this restores both the pc and the cpsr, and retries the aborted instruction.
S3C2440a risc microp rocessor programmer 's model 2 - 13 software interrupt the software interr upt instruction (swi) is used for entering supervisor mode, usually to request a particular supervisor function. a swi handler should return by executing the following irrespective of the state (arm or thumb): mov pc,r14_svc this restores the pc and cps r, and returns to the instruction following the swi. note nfiq, nirq, isync, lock, bigend, and abort pins exist only in the arm920t cpu core. undefined instruction when arm920t comes across an instruction which cannot be handled, it takes the undefined instruction trap. this mechanism may be used to extend either the thumb or arm instruction set by software emulation. after emulating the failed instruction, the trap handler should execute the following irrespective of the state (arm or thumb): movs pc,r14_und this restores the cpsr and returns to the instruction following the undefined instruction. exception vectors the following table shows the exception vector addresses. table 2 - 3. exception ve ctors address exception mode in entry 0x00000000 reset supervisor 0x00000004 undefined instruction undefined 0x00000008 software interrupt supervisor 0x0000000c abort (prefetch) abort 0x00000010 abort (data) abort 0x00000014 reserved reserved 0x0000 0018 irq irq 0x0000001c fiq fiq
programmer's model S3C2440a risc micro processor 2 - 14 exception priorities when multiple exceptions arise at the same time, a fixed priority system determines the order in which they are handled: highest priority: 1. reset 2. data abort 3. fiq 4. irq 5. prefetch abort lowest priority: 6. undefined instruction, software interrupt. not all exceptions can occur at once: undefined instruction and software interrupt are mutually exclusive, since they each correspond to particular (non - overlappin g) decodings of the current instruction. if a data abort occurs at the same time as a fiq, and fiqs are enabled (ie the cpsr's f flag is clear), arm920t enters the data abort handler and then immediately proceeds to the fiq vector. a normal return from fiq will cause the data abort handler to resume execution. placing data abort at a higher priority than fiq is necessary to ensure that the transfer error does not escape detection. the time for this exception entry should be added to worst - case fiq latency c alculations.
S3C2440a risc microp rocessor programmer 's model 2 - 15 interrupt latencies the worst case latency for fiq, assuming that it is enabled, consists of the longest time the request can take to pass through the synchronizer (tsyncmax if asynchronous), plus the time for the longest instruction to co mplete (tldm, the longest instruction is an ldm which loads all the registers including the pc), plus the time for the data abort entry (texc), plus the time for fiq entry (tfiq). at the end of this time arm920t will be executing the instruction at 0x1c. tsyncmax is 3 processor cycles, tldm is 20 cycles, texc is 3 cycles, and tfiq is 2 cycles. the total time is therefore 28 processor cycles. this is just over 1.4 microseconds in a system which uses a continuous 20 mhz processor clock. the maximum irq laten cy calculation is similar, but must allow for the fact that fiq has higher priority and could delay entry into the irq handling routine for an arbitrary length of time. the minimum latency for fiq or irq consists of the shortest time the request can take t hrough the synchronizer ( tsyncmin ) plus tfiq . this is 4 processor cycles. reset when the nreset signal goes low, arm920t abandons the executing instruction and then continues to fetch instructions from incrementing word addresses. when nreset goes high again, arm920t: 1. overwrites r14_svc and spsr_svc by copying the current values of the pc and cpsr into them. the value of the saved pc and spsr is not defined. 2. forces m[4:0] to 10011 (supervisor mode), sets the i and f bits in the cpsr, and clears the cpsr's t bit. 3. forces the pc to fetch the next instruction from address 0x00. 4. execution resumes in arm state.
programmer's model S3C2440a risc micro processor 2 - 16 notes
S3C2440a risc microprocessor arm instru ction set 3- 1 3 arm instruction set instruction set summay this chapter describes the arm instruction set in the arm920t core. format summary the following figure shows the arm instruction set. cond rn data/processing/ psr transfer 0 0 i s opcode 0 0 0 p u 0 w l 0 0 0 p u 1 w l 0 1 i p u b w l 0 1 i 1 0 0 p u b w l 1 1 1 1 1 1 1 1 1 0 l 1 1 1 0 p u b w l 1 1 1 1 1 1 0 1 1 1 0 1 l rd rd rn rdhi rdlo rn rn rn rn rd rd rd rn register list rn crn crn crd rd cp opc cp opc operand2 rs rm rm rm rm rn rn rd offset offset crd offset cp# cp# cp# cp cp crm crm ignored by processor 0 1 offset cond cond cond cond cond cond cond cond cond cond cond cond cond cond 0 0 0 0 0 0 a s a s u 1 0 0 0 0 0 0 0 0 0 0 1 b 1 0 0 0 1 0 0 0 1 1 1 1 1 1 0 0 0 0 h h 0 0 0 0 s s 1 1 1 0 1 1 1 0 0 1 0 0 1 0 0 1 0 0 1 multiply multiply long single data swap branch and exchange halfword data transfer: register offset halfword data transfer: immendiate offset single data transfer undefined block data transfer branch coprocessor register transfer coprocessor data operation coprocessor data transfer software interrupt offset 27 26 25 24 23 22 21 20 19 18 17 16 15 13 14 12 11 10 31 30 29 28 9 8 7 6 5 4 3 2 1 0 27 26 25 24 23 22 21 20 19 18 17 16 15 13 14 12 11 10 31 30 29 28 9 8 7 6 5 4 3 2 1 0 figure 3-1. arm instruction set format
arm instruction set S3C2440a risc micr oprocessor 3- 2 notes some instruction codes are not defined but does not cause undefined instruction trap to be taken, for instance a multiply instruction with bit 6 changed to a 1. these instructions should not be used, as their action may change in future arm implementations. instruction summary table 3-1. the arm instruction set mnemonic instruction action adc add with carry rd: = rn + op2 + carry add add rd: = rn + op2 and and rd: = rn and op2 b branch r15: = address bic bit clear rd: = rn and not op2 bl branch with link r14: = r15, r15: = address bx branch and exchange r15: = rn, t bit: = rn[0] cdp coprocessor data processing (coprocessor-specific) cmn compare negative cpsr flags: = rn + op2 cmp compare cpsr flags: = rn - op2 eor exclusive or rd: = (rn and not op2) or (op2 and not rn) ldc load coprocessor from memory coprocessor load ldm load multiple registers stack manipulation (pop) ldr load register from memory rd: = (address) mcr move cpu register to coprocessor register crn: = rrn {crm} mla multiply accumulate rd: = (rm rs) + rn mov move register or constant rd: = op2
S3C2440a risc microprocessor arm instru ction set 3- 3 table 3-1. the arm instruction set (continued) mnemonic instruction action mrc move from coprocessor register to cpu register rn: = crn {crm} mrs move psr status/flags to register rn: = psr msr move register to psr status/flags psr: = rm mul multiply rd: = rm rs mvn move negative register rd: = 0 ffffffff eor op2 orr or rd: = rn or op2 rsb reverse subtract rd: = op2 - rn rsc reverse subtract with carry rd: = op2 - rn - 1 + carry sbc subtract with carry rd: = rn - op2 - 1 + carry stc store coprocessor register to memory address: = crn stm store multiple stack manipulation (push) str store register to memory
: = rd sub subtract rd: = rn - op2 swi software interrupt os call swp swap register with memory rd: = [rn], [rn] := rm teq test bitwise equality cpsr flags: = rn eor op2 tst test bits cpsr flags: = rn and op2
arm instruction set S3C2440a risc micr oprocessor 3- 4 the condition field in arm state, all instructions are conditionally executed according to the state of the cpsr condition codes and the instruction's condition field. this field (bits 31:28) determines the circumstances under which an instruction is to be executed. if the state of the c, n, z and v flags fulfils the conditions encoded by the field, the instruction is executed, otherwise it is ignored. there are sixteen possible conditions, each represented by a two-character suffix that can be appended to the instruction's mnemonic. for example, a branch (b in assembly language) becomes beq for "branch if equal", which means the branch will only be taken if the z flag is set. in practice, fifteen different conditions may be used: these are listed in table 3-2. the sixteenth (1111) is reserved, and must not be used. in the absence of a suffix, the condition field for most instructions is set to "always" (suffix al). this means the instruction will always be executed regardless of the cpsr condition codes. table 3-2. condition code summary code suffix flags meaning 0000 eq z set equal 0001 ne z clear not equal 0010 cs c set unsigned higher or same 0011 cc c clear unsigned lower 0100 mi n set negative 0101 pl n clear positive or zero 0110 vs v set overflow 0111 vc v clear no overflow 1000 hi c set and z clear unsigned higher 1001 ls c clear or z set unsigned lower or same 1010 ge n equals v greater or equal 1011 lt n not equal to v less than 1100 gt z clear and (n equals v) greater than 1101 le z set or (n not equal to v) less than or equal 1110 al (ignored) always
S3C2440a risc microprocessor arm instru ction set 3- 5 branch and exchange (bx) this instruction is only executed if the condition is true. the various conditions are defined in table 3-2. this instruction performs a branch by copying the contents of a general register, rn, into the program counter, pc. the branch causes a pipeline flush and refill from the address specified by rn. this instruction also permits the instruction set to be exchanged. when the instruction is executed, the value of rn[0] determines whether the instruction stream will be decoded as arm or thumb instructions. 31 24 27 19 15 8 7 0 0 0 0 1 1 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 1 cond rn 28 16 11 12 23 20 4 3 [3:0] operand register if bit0 of rn = 1, subsequent instructions decoded as thumb instructions if bit0 of rn =0, subsequent instructions decoded as arm instructions [31:28] condition field figure 3-2. branch and exchange instructions instruction cycle times the bx instruction takes 2s + 1n cycles to execute, where s and n are defined as sequential (s-cycle) and non- sequential (n-cycle), respectively. assembler syntax bx - branch and exchange. bx {cond} rn {cond} two character condition mnemonic. see table 3-2. rn is an expression evaluating to a valid register number. using r15 as an operand if r15 is used as an operand, the behavior is undefined.
arm instruction set S3C2440a risc micr oprocessor 3- 6 examples adr r0, into_thumb + 1 generate branch target address and set bit 0 high ? hence it comes in thumb state bx r0 branch and change to thumb state. code16 assemble subsequent code as into_thumb thumb instructions adr r5, back_to_arm generate branch target to word aligned address hence bit 0 is low and so change back to arm state. bx r5 branch and change back to arm state. align word alignment code32 assemble subsequent code as arm instructions back_to_arm ?
S3C2440a risc microprocessor arm instru ction set 3- 7 branch and branch with link (b, bl) the instruction is only executed if the condition is true. the various conditions are defined table 3-2. the instruction encoding is shown in figure 3-3, below. 31 24 27 cond offset 28 23 [24] link bit 0 = branch 1 = branch with link [31:28] condition field 25 101 l 0 figure 3-3. branch instructions branch instruction contains a signed 2's complement 24 bit offset. this is shifted left two bits, sign extended to 32 bits, and added to the pc. the instruction can therefore specify a branch of +/- 32mbytes. the branch offset must take account of the prefetch operation, which causes the pc to be 2 words (8 bytes) ahead of the current instruction. branches beyond +/- 32mbytes must use an offset or absolute destination which has been previously loaded into a register. in this case the pc should be manually saved in r14 if a branch with link type operation is required. the link bit branch with link (bl) writes the old pc into the link register (r14) of the current bank. the pc value written into r14 is adjusted to allow for the prefetch, and contains the address of the instruction following the branch and link instruction. note that the cpsr is not saved with the pc and r14[1:0] are always cleared. to return from a routine called by branch with link use mov pc,r14 if the link register is still valid or ldm rn!,{..pc} if the link register has been saved onto a stack pointed to by rn. instruction cycle times branch and branch with link instructions take 2s + 1n incremental cycles, where s and n are defined as sequential (s-cycle) and internal (i-cycle).
arm instruction set S3C2440a risc micr oprocessor 3- 8 assembler syntax items in ?{}? are optional. items in ?<>? must be present. b{l}{cond} {l} used to request the branch with link form of the instruction. if absent, r14 will not be affected by the instruction. {cond} a two-character mnemonic as shown in table 3-2. if absent then al (always) will be used. the destination. the assembler calculates the offset examples here bal here ; assembles to 0xeafffffe (note effect of pc offset). b there ; always condition used as default. cmp r1,#0 ; compare r1 with zero and branch to fred if r1 was zero, otherwise continue. beq fred ; continue to next instruction. bl sub+rom ; call subroutine at computed address. adds r1,#1 ; ad d 1 to register 1, setting cpsr flags on the result then call subroutine if blcc sub ; the c flag is clear, which will be the case unless r1 held 0xffffffff.
S3C2440a risc microprocessor arm instru ction set 3- 9 data processing the data processing instruction is only executed if the condition is true. the conditions are defined in table 3-2. the instruction encoding is shown in figure 3-4. 31 24 27 19 15 cond operand2 28 16 11 12 21 [15:12] destination register 0 = branch 1 = branch with link [19:16] 1st operand register 0 = branch 1 = branch with link [20] set condition codes 0 = do not after condition codes 1 = set condition codes [24:21] operation codes 0000 = and-rd: = op1 and op2 0001 = eor-rd: = op1 eor op2 0010 = sub-rd: = op1-op2 0011 = rsb-rd: = op2-op1 0100 = add-rd: = op1+op2 0101 = adc-rd: = op1+op2+c 0110 = sbc-rd: = op1-op2+c-1 0111 = rsc-rd: = op2-op1+c-1 1000 = tst-set condition codes on op1 and op2 1001 = teo-set condition codes on op1 eor op2 1010 = cmp-set condition codes on op1-op2 1011 = smn-set condition codes on op1+op2 1100 = orr-rd: = op1 or op2 1101 = mov-rd: =op2 1110 = bic-rd: = op1 and not op2 1111 = mvn-rd: = not op2 [25] immediate operand 0 = operand 2 is a register 1 = operand 2 is an immediate value [11:0] operand 2 type selection 26 25 00 l 20 opcode s rn rd 0 rotate shift rm [3:0] 2nd operand register [11:4] shift applied to rm 3 11 0 4 8 11 0 7 imm [7:0] unsigned 8 bit immediate value [11:8] shift applied to imm [31:28] condition field figure 3-4. data processing instructions
arm instruction set S3C2440a risc micr oprocessor 3- 10 the instruction produces a result by performing a specified arithmetic or logical operation on one or two operands. the first operand is always a register (rn). the second operand may be a shifted register (rm) or a rotated 8 bit immediate value (imm) according to the value of the i bit in the instruction. the condition codes in the cpsr may be preserved or updated as a result of this instruction, according to the value of the s bit in the instruction. certain operations (tst, teq, cmp, cmn) do not write the result to rd. they are used only to perform tests and to set the condition codes on the result and always have the s bit set. the instructions and their effects are listed in table 3-3.
S3C2440a risc microprocessor arm instru ction set 3- 11 cpsr flags the data processing operations can be classified as logical or arithmetic. the logical operations (and, eor, tst, teq, orr, mov, bic, mvn) perform the logical action on all corresponding bits of the operand or operands to produce the result. if the s bit is set (and rd is not r15, see below) the v flag in the cpsr will be unaffected. the c flag will be set to the carry out from the barrel shifter (or preserved when the shift operation is lsl #0), the z flag will be set if and only if the result is all zeros, and the n flag will be set to the logical value of bit 31 of the result. table 3-3. arm data processing instructions assembler mnemonic op code action and 0000 operand1 and operand2 eor 0001 operand1 eor operand2 wub 0010 operand1 - operand2 rsb 0011 operand2 operand1 add 0100 operand1 + operand2 adc 0101 operand1 + operand2 + carry sbc 0110 operand1 - operand2 + carry - 1 rsc 0111 operand2 - operand1 + carry - 1 tst 1000 as and, but result is not written teq 1001 as eor, but result is not written cmp 1010 as sub, but result is not written cmn 1011 as add, but result is not written orr 1100 operand1 or operand2 mov 1101 operand2 (operand1 is ignored) bic 1110 operand1 and not operand2 (bit clear) mvn 1111 not operand2 (operand1 is ignored) the arithmetic operations (sub, rsb, add, adc, sbc, rsc, cmp, cmn) treat each operand as a 32 bit integer (either unsigned or 2's complement signed, the two are equivalent). if the s bit is set (and rd is not r15) the v flag in the cpsr will be set if an overflow occurs into bit 31 of the result; this may be ignored if the operands were considered unsigned, but warns of a possible error if the operands were 2's complement signed. the c flag will be set to the carry out of bit 31 of the alu, the z flag will be set if and only if the result was zero, and the n flag will be set to the value of bit 31 of the result (indicating a negative result if the operands are considered to be 2's complement signed).
arm instruction set S3C2440a risc micr oprocessor 3- 12 shifts when the second operand is specified to be a shifted register, the operation of the barrel shifter is controlled by the shift field in the instruction. this field indicates the type of shift to be performed (logical left or right, arithmetic right or rotate right). the amount by which the register should be shifted may contain an immediate field in the instruction, or in the bottom byte of another register (other than r15). the encoding for the different shift types is shown in figure 3- 5. 0 [6:5] shift type 00 = logical left 01 = logical right 10 = arithmetic right 11 = rotate right [11:7] shift amount 5 bit unsigned integer [6:5] shift type 00 = logical left 01 = logical right 10 = arithmetic right 11 = rotate right [11:8] shift register shift amount specified in bottom-byte of rs 4 5 6 7 11 1 4 5 6 7 11 8 0 rs figure 3-5. arm shift operations instruction specified shift amount when the shift amount is specified in the instruction, it is contained in a 5 bit field which can take any value from 0 to 31. a logical shift left (lsl) takes the contents of rm and moves each bit by the specified amount to a more significant position. the least significant bits of the result are filled with zeros, and the high bits of rm which do not map into the result are discarded, except that the least significant discarded bit becomes the shifter carry output which may be latched into the c bit of the cpsr when the alu operation is in the logical class (see above). for example, the effect of lsl #5 is shown in figure 3-6. 31 27 26 contents of rm value of operand 2 carry out 0 0 0 0 0 0 figure 3-6. logical shift left note lsl #0 is a special case, where the shifter carries out is the old value of the cpsr c flag. the contents of rm are used directly as the second operand. a logical shift right (lsr) is similar, but the contents of rm are moved to less significant positions in the result. lsr #5 has the effect shown in figure 3-7 .
S3C2440a risc microprocessor arm instru ction set 3- 13 31 contents of rm value of operand 2 0 carry out 4 5 0 0 0 0 0 figure 3-7. logical shift right the form of the shift field which might be expected to correspond to lsr #0 is used to encode lsr #32, which has a zero result with bit 31 of rm as the carry output. logical shift right zero is redundant as it is the same as logical shift left zero, so the assembler will convert lsr #0 (and asr #0 and ror #0) into lsl #0, and allow lsr #32 to be specified. an arithmetic shift right (asr) is similar to logical shift right, except that the high bits are filled with bit 31 of rm instead of zeros. this preserves the sign in 2's complement notation. for example, asr #5 is shown in figure 3-8. 31 contents of rm value of operand 2 0 carry out 4 5 30 figure 3-8. arithmetic shift right the form of the shift field which might be expected to give asr #0 is used to encode asr #32. bit 31 of rm is again used as the carry output, and each bit of operand 2 is also equal to bit 31 of rm. the result is therefore all ones or all zeros, according to the value of bit 31 of rm.
arm instruction set S3C2440a risc micr oprocessor 3- 14 rotate right (ror) operations reuse the bits which "overshoot" in a logical shift right operation by reintroducing them at the high end of the result, in place of the zeros used to fill the high end in logical right operations. for example, ror #5 is shown in figure 3-9. 31 contents of rm value of operand 2 0 carry out 4 5 figure 3-9. rotate right the form of the shift field which might be expected to give ror #0 is used to encode a special function of the barrel shifter, rotate right extended ( rrx). this is a rotate right by one bit position of the 33 bit quantity formed by appending the cpsr c flag to the most significant end of the contents of rm as shown in figure 3-10. 31 contents of rm value of operand 2 0 1 carry out c in figure 3-10. rotate right extended
S3C2440a risc microprocessor arm instru ction set 3- 15 register specified shift amount only the least significant byte of the contents of rs is used to determine the shift amount. rs can be any general register other than r15. if this byte is zero, the unchanged contents of rm will be used as the second operand, and the old value of the cpsr c flag will be passed on as the shifter carry output. if the byte has a value between 1 and 31, the shifted result will exactly match that of an instruction specified shift with the same value and shift operation. if the value in the byte is 32 or more, the result will be a logical extension of the shift described above: 1. lsl by 32 has result zero, carry out equal to bit 0 of rm. 2. lsl by more than 32 has result zero, carry out zero. 3. lsr by 32 has result zero, carry out equal to bit 31 of rm. 4. lsr by more than 32 has result zero, carry out zero. 5. asr by 32 or more has result filled with and carry out equal to bit 31 of rm. 6. ror by 32 has result equal to rm, carry out equal to bit 31 of rm. 7. ror by n where n is grea ter than 32 will give the same result and carry out as ror by n-32; therefore repeatedly subtract 32 from n until the amount is in the range 1 to 32 and see above. note the zero in bit 7 of an instruction with a register controlled shift is compulsory; a one in this bit will cause the instruction to be a multiply or undefined instruction.
arm instruction set S3C2440a risc micr oprocessor 3- 16 immediate operand rotates the immediate operand rotate field is a 4 bit unsigned integer which specifies a shift operation on the 8 bit immediate value. this value is zero extended to 32 bits, and then subject to a rotate right by twice the value in the rotate field. this enables many common constants to be generated, for example all powers of 2. writing to r15 when rd is a register other than r15, the condition code flags in the cpsr may be updated from the alu flags as described above. when rd is r15 and the s flag in the instruction is not set the result of the operation is placed in r15 and the cpsr is unaffected. when rd is r15 and the s flag is set the result of the operation is placed in r15 and the spsr corresponding to the current mode is moved to the cpsr. this allows state changes which automatically restore both pc and cpsr. this form of instruction should not be used in user mode. using r15 as an operandy if r15 (the pc) is used as an operand in a data processing instruction the register is used directly. the pc value will be the address of the instruction, plus 8 or 12 bytes due to instruction prefetching. if the shift amount is specified in the instruction, the pc will be 8 bytes ahead. if a register is used to specify the shift amount the pc will be 12 bytes ahead. teq, tst, cmp and cmn opcodes note teq, tst, cmp and cmn do not write the result of their operation but do set flags in the cpsr. an assembler should always set the s flag for these instructions even if this is not specified in the mnemonic. the teqp form of the teq instruction used in earlier arm processors must not be used: the psr transfer operations should be used instead. the action of teqp in the arm920t is to move spsr_ to the cpsr if the processor is in a privileged mode and to do nothing if in user mode. instruction cycle times data processing instructions vary in the number of incremental cycles taken as follows: table 3-4. incremental cycle times processing type cycles normal data processing 1s data processing with register specified shift 1s + 1i data processing with pc written 2s + 1n data processing with register specified shift and pc written 2s + 1n +1i note: s, n and i are as defined sequential (s-cycle), non-sequential (n-cycle), and internal (i-cycle) respectively.
S3C2440a risc microprocessor arm instru ction set 3- 17 assembler syntax mov,mvn (single operand instructions). {cond}{s} rd, cmp,cmn,teq,tst (instructions which do not produce a result). {cond} rn, and,eor,sub,rsb, add,adc,sbc,rsc,orr,bic {cond}{s} rd,rn, where: rm{,} or,<#expression> {cond} a two-character condition mnemonic. see table 3-2. {s} set condition codes if s present (implied for cmp, cmn, teq, tst). rd, rn and rm expressions evaluating to a register number. <#expression> if this is used, the assembler will attempt to generate a shifted immediate 8-bit field to match the expression. if this is impossible, it will give an error. or #expression, or rrx (rotate right one bit with extend). s asl, lsl, lsr, asr, ror. (asl is a synonym for lsl, they assemble to the same code.) examples addeq r2,r4,r5 ; if the z flag is set make r2:=r4+r5 teqs r4,#3 ; test r4 for equality with 3. ; (the s is in fact redundant as the ; assembler inserts it automatically.) sub r4,r5,r7,lsr r2 ; logical right shift r7 by the number in ; the bottom byte of r2, subtract result ; from r5, and put the answer into r4. mov pc,r14 ; return from subroutine. movs pc,r14 ; return from exception and restore cpsr ; from spsr_mode.
arm instruction set S3C2440a risc micr oprocessor 3- 18 psr transfer (mrs, msr) the instruction is only executed if the condition is true. the various conditions are defined in table 3-2. the mrs and msr instructions are formed from a subset of the data processing operations and are implemented using the teq, tst, cmn and cmp instructions without the s flag set. the encoding is shown in figure 3-11. these instructions allow access to the cpsr and spsr registers. the mrs instruction allows the contents of the cpsr or spsr_ to be moved to a general register. the msr instruction allows the contents of a general register to be moved to the cpsr or spsr_ register. the msr instruction also allows an immediate value or register contents to be transferred to the condition code flags (n,z,c and v) of cpsr or spsr_ without affecting the control bits. in this case, the top four bits of the specified register contents or 32 bit immediate value are written to the top four bits of the relevant psr. operand restrictions in user mode, the control bits of the cpsr are protected from change, so only the condition code flags of the cpsr can be changed. in other (privileged) modes the entire cpsr can be changed. note that the software must never change the state of the t bit in the cpsr. if this happens, the processor will enter an unpredictable state. the spsr register which is accessed depends on the mode at the time of execution. for example, only spsr_fiq is accessible when the processor is in fiq mode. you must not specify r15 as the source or destination register. also, do not attempt to access an spsr in user mode, since no such register exists.
S3C2440a risc microprocessor arm instru ction set 3- 19 msr (transfer register contents or immediate value to psr flag bits only) cond source operand pd 101001111 31 22 27 28 11 12 21 23 i 10 00 26 25 24 0 cond 00000000 00010 pd 101001111 31 22 27 28 11 12 21 23 rm msr (transfer register contents to psr) 4 3 0 cond 000000000000 00010 rd ps 001111 31 22 27 15 28 16 11 12 21 23 mrs (transfer psr contents to a register) 0 [3:0] source register [22] destination psr 0 = cpsr 1 = spsr_ [31:28] condition field [15: 12 ] destination register [ 22 ] source psr 0 = cpsr 1 = spsr_ [31:28] condition field [3:0] source register [11:4] source operand is an immediate value [7:0] unsigned 8 bit immediate value [11:8] shift applied to imm [22] destination psr 0 = cpsr 1 = spsr_ [25] immediate operand 0 = source operand is a register 1 = spsr_ [11:0] source operand [31:28] condition field 00000000 rm 11 4 3 0 rotate imm 11 0 8 7 figure 3-11. psr transfer
arm instruction set S3C2440a risc micr oprocessor 3- 20 reserved bits only twelve bits of the psr are defined in arm920t (n,z,c,v,i,f, t & m[4:0]); the remaining bits are reserved for use in future versions of the processor. refer to figure 2-6 for a full description of the psr bits. to ensure the maximum compatibility between arm920t programs and future processors, the following rules should be observed: the reserved bits should be preserved while changing the value in a psr. programs should not rely on specific values from the reserved bits while checking the psr status, since they may read as one or zero in future processors. a read-modify-write strategy should therefore be used when altering the control bits of any psr register; this involves transferring the appropriate psr register to a general register using the mrs instruction, changing only the relevant bits and then transferring the modified value back to the psr register using the msr instruction. examples the following sequence performs a mode change: mrs r0,cpsr ; take a copy of the cpsr. bic r0,r0,#0x1f ; clear the mode bits. orr r0,r0,#new_mode ; select new mode msr cpsr,r0 ; write back the modified cpsr. when the aim is simply to change the condition code flags in a psr, a value can be written directly to the flag bits without disturbing the control bits. the following instruction sets the n,z,c and v flags: msr cpsr_flg,#0xf0000000 ; set all the flags regardless of their previous state ; (does not affect any control bits). no attempt should be made to write an 8 bit immediate value into the whole psr since such an operation cannot preserve the reserved bits. instruction cycle times psr transfers take 1s incremental cycles, where s is defined as sequential (s-cycle).
S3C2440a risc microprocessor arm instru ction set 3- 21 assembly syntax mrs - transfer psr contents to a register mrs{cond} rd, msr - transfer register contents to psr msr{cond} ,rm msr - transfer register contents to psr flag bits only msr{cond} ,rm the most significant four bits of the register contents are written to the n,z,c & v flags respectively. msr - transfer immediate value to psr flag bits only msr{cond} ,<#expression> the expression should symbolise a 32 bit value of which the most significant four bits are written to the n,z,c and v flags respectively. key: {cond} two-character condition mnemonic. see table 3-2.. rd and rm expressions evaluating to a register number other than r15 cpsr, cpsr_all, spsr or spsr_all. (cpsr and cpsr_all are synonyms as are spsr and spsr_all) cpsr_flg or spsr_flg <#expression> where this is used, the assembler will attempt to generate a shifted immediate 8-bit field to match the expression. if this is impossible, it will give an error. examples in user mode the instructions behave as follows: msr cpsr_all,rm ; cpsr[31:28] <- rm[31:28] msr cpsr_flg,rm ; cpsr[31:28] <- rm[31:28] msr cpsr_flg,#0xa0000000 ; cpsr[31:28] <- 0xa (set n,c; clear z,v) mrs rd,cpsr ; rd[31:0] <- cpsr[31:0] in privileged modes the instructions behave as follows: msr cpsr_all,rm ; cpsr[31:0] <- rm[31:0] msr cpsr_flg,rm ; cpsr[31:28] <- rm[31:28] msr cpsr_flg,#0x50000000 ; cpsr[31:28] <- 0x5 (set z,v; clear n,c) msr spsr_all,rm ; spsr_[31:0]<- rm[31:0] msr spsr_flg,rm ; spsr_[31:28] <- rm[31:28] msr spsr_flg,#0xc0000000 ; spsr_[31:28] <- 0xc (set n,z; clear c,v) mrs rd,spsr ; rd[31:0] <- spsr_[31:0]
arm instruction set S3C2440a risc micr oprocessor 3- 22 multiply and multiply-accumulate (mul, mla) the instruction is only executed if the condition is true. the various conditions are defined in table 3-2. the instruction encoding is shown in figure 3-12. the multiply and multiply-accumulate instructions use an 8 bit booth's algorithm to perform integer multiplication. 31 27 19 15 cond 28 16 11 12 21 20 s rd rn [15:12][11:8][3:0] operand registers [19:16] destination register [20] set condition code 0 = do not after condition codes 1 = set condition codes [21] accumulate 0 = multiply only 1 = multiply and accumulate [31:28] condition field 22 1 0 0 1 rs rm a 0 0 0 0 0 0 8 7 4 3 0 figure 3-12. multiply instructions the multiply form of the instruction gives rd:=rm*rs. rn is ignored, and should be set to zero for compatibility with possible future upgrades to the instruction set. the multiply-accumulate form gives rd:=rm*rs+rn, which can save an explicit add instruction in some circumstances. both forms of the instruction work on operands which may be considered as signed (2's complement) or unsigned integers. the results of a signed multiply and of an unsigned multiply of 32 bit operands differ only in the upper 32 bits - the low 32 bits of the signed and unsigned results are identical. as these instructions only produce the low 32 bits of a multiply, they can be used for both signed and unsigned multiplies. for example consider the multiplication of the operands: operand a o perand b result 0xfffffff6 0x0000001 0xffffff38
S3C2440a risc microprocessor arm instru ction set 3- 23 if the operands are interpreted as signed operand a has the value -10, operand b has the value 20, and the result is -200 which is correctly represented as 0xffffff38. if the operands are interpreted as unsigned operand a has the value 4294967286, operand b has the value 20 and the result is 85899345720, which is represented as 0x13ffffff38, so the least significant 32 bits are 0xffffff38. operand restrictions the destination register rd must not be the same as the operand register rm. r15 must not be used as an operand or as the destination register. all other register combinations will give correct results, and rd, rn and rs may use the same register when required.
arm instruction set S3C2440a risc micr oprocessor 3- 24 cpsr flags setting the cpsr flags is optional, and is controlled by the s bit in the instruction. the n (negative) and z (zero) flags are set correctly on the result (n is made equal to bit 31 of the result, and z is set if and only if the result is zero). the c (carry) flag is set to a meaningless value and the v (overflow) flag is unaffected. instruction cycle times mul takes 1s + mi and mla 1s + (m+1)i cycles to execute, where s and i are defined as sequential (s-cycle) and internal (i-cycle), respectively. m the number of 8 bit multiplier array cycles is required to complete the multiply, which is controlled by the value of the multiplier operand specified by rs. its possible values are as follows 1 if bits [32:8] of the multiplier operand are all zero or all one. 2 if bits [32:16] of the multiplier operand are all zero or all one. 3 if bits [32:24] of the multiplier operand are all zero or all one. 4 in all other cases. assembler syntax mul{cond}{s} rd,rm,rs mla{cond}{s} rd,rm,rs,rn {cond} two-character condition mnemonic. see table 3-2.. {s} set condition codes if s present rd, rm, rs and rn expressions evaluating to a register number other than r15. examples mul r1,r2,r3 ; r1:=r2*r3 mlaeqs r1,r2,r3,r4 ; conditionally r1:=r2*r3+r4, setting condition code s.
S3C2440a risc microprocessor arm instru ction set 3- 25 multiply long and multiply-accumulate long (mull, mlal) the instruction is only executed if the condition is true. the various conditions are defined in table 3-2. the instruction encoding is shown in figure 3-13. the multiply long instructions perform integer multiplication on two 32 bit operands and produce 64 bit results. signed and unsigned multiplication each with optional accumulate give rise to four variations. 31 27 19 15 cond 28 16 11 12 21 23 u 20 s rdhi rdlo [11:8][3:0] operand registers [19:16][15:12] source destination registers [20] set condition code 0 = do not alter condition codes 1 = set condition codes [21] accumulate 0 = multiply only 1 = multiply and accumulate [22] unsigned 0 = unsigned 1 = signed [31:28] condition field 22 0 0 0 0 1 1 0 0 1 rs rm a 8 7 4 3 0 figure 3-13. multiply long instructions the multiply forms (umull and smull) take two 32 bit numbers and multiply them to produce a 64 bit result of the form rdhi,rdlo := rm * rs. the lower 32 bits of the 64 bit result are written to rdlo, the upper 32 bits of the result are written to rdhi. the multiply-accumulate forms (umlal and smlal) take two 32 bit numbers, multiply them and add a 64 bit number to produce a 64 bit result of the form rdhi,rdlo := rm * rs + rdhi,rdlo. the lower 32 bits of the 64 bit number to add is read from rdlo. the upper 32 bits of the 64 bit number to add is read from rdhi. the lower 32 bits of the 64 bit result are written to rdlo. the upper 32 bits of the 64 bit result are written to rdhi. the umull and umlal instructions treat all of their operands as unsigned binary numbers and write an unsigned 64 bit result. the smull and smlal instructions treat all of their operands as two's-complement signed numbers and write a two's-complement signed 64 bit result.
arm instruction set S3C2440a risc micr oprocessor 3- 26 operand restrictions r15 must not be used as an operand or as a destination register. rdhi, rdlo, and rm must all specify different registers. cpsr flags setting the cpsr flags is optional, and is controlled by the s bit in the instruction. the n and z flags are set correctly on the result (n is equal to bit 63 of the result, z is set if and only if all 64 bits of the result are zero). both the c and v flags are set to meaningless values. instruction cycle times mull takes 1s + (m+1)i and mlal 1s + (m+2)i cycles to execute, where m is the number of 8 bit multiplier array cycles required to complete the multiply, which is controlled by the value of the multiplier operand specified by rs. its possible values are as follows: for signed instructions smull, smlal: if bits [31:8] of the multiplier operand are all zero or all one. if bits [31:16] of the multiplier operand are all zero or all one. if bits [31:24] of the multiplier operand are all zero or all one. in all other cases. for unsigned instructions umull, umlal: if bits [31:8] of the multiplier operand are all zero. if bits [31:16] of the multiplier operand are all zero. if bits [31:24] of the multiplier operand are all zero. in all other cases. s and i are defined as sequential (s-cycle) and internal (i-cycle), respectively.
S3C2440a risc microprocessor arm instru ction set 3- 27 assembler syntax table 3-5. assembler syntax descriptions mnemonic description purpose umull{cond}{s} rdlo,rdhi,rm,rs unsigned multiply long 32 x 32 = 64 umlal{cond}{s} rdlo,rdhi,rm,rs unsigned multiply & accumulate long 32 x 32 + 64 = 64 smull{cond}{s} rdlo,rdhi,rm,rs signed multiply long 32 x 32 = 64 smlal{cond}{s} rdlo,rdhi,rm,rs signed multiply & accumulate long 32 x 32 + 64 = 64 where: {cond} two-character condition mnemonic. see table 3-2. {s} set condition codes if s present rdlo, rdhi, rm, rs expressions evaluating to a register number other tha n r15. examples umull r1,r4,r2,r3 ; r4,r1:=r2*r3 umlals r1,r5,r2,r3 ; r5,r1:=r2*r3+r5,r1 also setting condition codes
arm instruction set S3C2440a risc micr oprocessor 3- 28 single data transfer (ldr, str) the instruction is only executed if the condition is true. the various conditions are defined in table 3-2. the instruction encoding is shown in figure 3-14. the single data transfer instructions are used to load or store single bytes or words of data. the memory address used in the transfer is calculated by adding an offset to or subtracting an offset from a base register. the result of this calculation may be written back into the base register if auto-indexing is required. 31 27 19 15 0 cond 28 16 11 12 21 23 b 20 l rn rd 22 01 i p u offset w 26 24 25 [15:12] source/destination registers [19:16] base register [20] load/store bit 0 = store to memory 1 = load from memory [21] write-back bit 0 = no write-back 1 = write address into base [22] byte/word bit 0 = transfer word quantity 1 = transfer byte quantity [23] up/down bit 0 = down: subtract offset from base 1 = up: add offset to base [24] pre/post indexing bit 0 = post: add offset after transfer 1 = pre: add offset before transfer [25] immediate offset 0 = offset is an immediate value [11:0] offset shift immediate [11:0] unsigned 12-bit immediate offset 11 11 rm [3:0] offset register [11:4] shift applied to rm [31:28] condition field 0 4 3 0 figure 3-14. single data transfer instructions
S3C2440a risc microprocessor arm instru ction set 3- 29 offsets and auto-indexing the offset from the base may be either a 12 bit unsigned binary immediate value in the instruction, or a second register (possibly shifted in some way). the offset may be added to (u=1) or subtracted from (u=0) the base register rn. the offset modification may be performed either before (pre-indexed, p=1) or after (post-indexed, p=0) the base is used as the transfer address. the w bit gives optional auto increment and decrement addressing modes. the modified base value may be written back into the base (w=1), or the old base value may be kept (w=0). in the case of post-indexed addressing, the write back bit is redundant and is always set to zero, since the old base value can be retained by setting the offset to zero. therefore post-indexed data transfers always write back the modified base. the only use of the w bit in a post- indexed data transfer is in privileged mode code, where setting the w bit forces non-privileged mode for the transfer, allowing the operating system to generate a user address in a system where the memory management hardware makes suitable use of this hardware. shifted register offset the 8 shift control bits are described in the data processing instructions section. however, the register specified shift amounts are not available in this instruction class. see figure 3-5. bytes and words this instruction class may be used to transfer a byte (b=1) or a word (b=0) between an arm920t register and memory. the action of ldr(b) and str(b) instructions is influenced by the bigend control signal of arm920t core. the two possible configurations are described below. little-endian configuration a byte load (ldrb) expects the data on data bus inputs 7 through 0 if the supplied address is on a word boundary, on data bus inputs 15 through 8, if it is a word address plus one byte, and so on. the selected byte is placed in the bottom 8 bits of the destination register, and the remaining bits of the register are filled with zeros. please see figure 2-2. a byte store (strb) repeats the bottom 8 bits of the source register four times across data bus outputs 31 through 0. the external memory system should activate the appropriate byte subsystem to store the data. a word load (ldr) will normally use a word aligned address. however, an address offset from a word boundary will cause the data to be rotated into the register so that the addressed byte occupies bits 0 to 7. this means that half- words accessed at offsets 0 and 2 from the word boundary will be correctly loaded into bits 0 through 15 of the register. two shift operations are then required to clear or to sign extend the upper 16 bits. a word store (str) should generate a word aligned address. the word presented to the data bus is not affected if the address is not word aligned. that is, bit 31 of the register being stored always appears on data bus output 31.
arm instruction set S3C2440a risc micr oprocessor 3- 30 ldr from word aligned address a+3 a a+2 a+1 memory 24 16 8 0 a b c d register 24 16 8 0 a b c d ldr from address offset by 2 a+3 a a+2 a+1 memory 24 16 8 0 a b c d register 24 16 8 0 a b c d figure 3-15. little-endian offset addressing big-endian configuration a byte load (ldrb) expects the data on data bus inputs 31 through 24 if the supplied address is on a word boundary, on data bus inputs 23 through 16 if it is a word address plus one byte, and so on. the selected byte is placed in the bottom 8 bits of the destination register and the remaining bits of the register are filled with zeros. please see figure 2-1. a byte store (strb) repeats the bottom 8 bits of the source register four times across data bus outputs 31 through 0. the external memory system should activate the appropriate byte subsystem to store the data. a word load (ldr) should generate a word aligned address. an address offset of 0 or 2 from a word boundary will cause the data to be rotated into the register so that the addressed byte occupies bits 31 through 24. this means that half-words accessed at these offsets will be correctly loaded into bits 16 through 31 of the register. a shift operation is then required to move (and optionally sign extend) the data into the bottom 16 bits. an address offset of 1 or 3 from a word boundary will cause the data to be rotated into the register so that the addressed byte occupies bits 15 through 8. a word store (str) should generate a word aligned address. the word presented to the data bus is not affected if the address is not word aligned. that is, bit 31 of the register being stored always appears on data bus output 31.
S3C2440a risc microprocessor arm instru ction set 3- 31 use of r15 write-back must not be specified if r15 is specified as the base register (rn). while using r15 as the base register, you must remember it contains an address of 8 bytes on from the address of the current instruction. r15 must not be specified as the register offset (rm). when r15 is the source register (rd) of a register store (str) instruction, the stored value will be address of the instruction plus 12. restriction are made depending on the use of base register when configured for late aborts, the following example code is difficult to unwind as the base register, rn, gets updated before the abort handler starts. sometimes it may be impossible to calculate the initial value. after an abort, the following example code is difficult to unwind as the base register, rn, gets updated before the abort handler starts. sometimes it may be impossible to calculate the initial value. example: ldr r0,[r1],r1 therefore a post-indexed ldr or str where rm is the same register as rn should not be used. data aborts a transfer to or from a legal address may cause problems for a memory management system. for instance, in a system which uses virtual memory the required data may be absent from main memory. the memory manager can signal a problem by taking the processor abort input high whereupon the data abort trap will be taken. it is up to the system software to resolve the cause of the problem, then the instruction can be restarted and the original program continued. instruction cycle times normal ldr instructions take 1s + 1n + 1i and ldr pc take 2s + 2n +1i incremental cycles, where s,n and i are defined as sequential (s-cycle), non-sequential (n-cycle), and internal (i-cycle), respectively. str instructions take 2n incremental cycles to execute.
arm instruction set S3C2440a risc micr oprocessor 3- 32 assembler syntax {cond}{b}{t} rd,
where: ldr load from memory into a register str store from a register into memory {cond} two-character condition mnemonic. see table 3-2. {b} if b is present then byte transfer, otherwise word transfer {t} if t is present the w bit will be set in a post-indexed instruction, forcing non-privileged mode for the transfer cycle. t is not allowed when a pre-indexed addressing mode is specified or implied. rd an expression evaluating to a valid register number. rn and rm expr essions evaluating to a register number. if rn is r15 then the assembler will subtract 8 from the offset value to allow for arm920t pipelining. in this case base write-back should not be specified.
can be: 1 an expression which generates an address: the assembler will attempt to generate an instruction using the pc as a base and a corrected immediate offset to address the location given by evaluating the expression. this will be a pc relative, pre-indexed address. if the address is out of range, an error will be generated. 2 a pre-indexed addressing specification: [rn] offset of zero [rn,<#expression>]{!} offset of bytes [rn,{+/-}rm{,}]{!} offset of +/- contents of index register, shifted by 3 a post-indexed addressing specification: [rn],<#expression> offset of bytes [rn],{+/-}rm{,} offset of +/- contents of index register, shifted as by . general shift operatio n (see data processing instructions) but you cannot specify the shift amount by a register. {!} writes back the base register (set the w bit) if! is present.
S3C2440a risc microprocessor arm instru ction set 3- 33 examples str r1,[r2,r4]! ; store r1 at r2+r4 (both of which are registers) ; and write back address to r2. str r1,[r2],r4 ; store r1 at r2 and write back r2+r4 to r2. ldr r1,[r2,#16] ; load r1 from contents of r2+16, but don't write back. ldr r1,[r2,r3,lsl#2] ; load r1 from contents of r2+r3*4. ldreqb r1,[r6,#5] ; conditionally loa d byte at r6+5 into ; r1 bits 0 to 7, filling bits 8 to 31 with zeros. str r1,place ; generate pc relative offset to address place. place
arm instruction set S3C2440a risc micr oprocessor 3- 34 halfwo rd and signed data transfer (ldrh/strh/ldrsb/ldrsh) the instruction is only executed if the condition is true. the various conditions are defined in table 3-2. the instruction encoding is shown in figure 3-16. these instructions are used to load or store half-words of data and also load sign -extended bytes or half-words of data. the memory address used in the transfer is calculated by adding an offset to or subtracting an offset from a base register. the result of this calculation may be written back into the base register if auto-indexing is required. 31 27 19 15 cond 28 16 11 12 21 23 0 20 l rn rd [3:0] offset register [6][5] s h 0 0 = swp instruction 0 1 = unsigned halfword 1 1 = signed byte 1 1 = signed halfword [15:12] source/destination register [19:16] base register [20] load/store 0 = store to memory 1 = load from memory [21] write-back 0 = no write-back 1 = write address into base [23] up/down 0 = down: subtract offset from base 1 = up: add offset to base [24] pre/post indexing 0 = post: add/subtract offset after transfer 1 = pre: add/subtract offset bofore transfer [31:28] condition field 22 000 p u 0000 w 24 25 1 rm s h 1 8 7 6 5 4 3 0 figure 3-16. halfword and signed data transfer with register offset
S3C2440a risc microprocessor arm instru ction set 3- 35 31 27 19 15 cond 28 16 11 12 21 23 1 20 l rn rd [3:0] immediate offset (low nibble) [6][5] s h 0 0 = swp instruction 0 1 = unsigned halfword 1 1 = signed byte 1 1 = signed halfword [11:8] immediate offset (high nibble) [15:12] source/destination register [19:16] base register [20] load/store 0 = store to memory 1 = load from memory [21] write-back 0 = no write-back 1 = write address into base [23] up/down 0 = down: subtract offset from base 1 = up: add offset to base [24] pre/post indexing 0 = post: add/subtract offset after transfer 1 = pre: add/subtract offset bofore transfer [31:28] condition field 22 000 p u offset w 24 25 1 offset s h 1 8 7 6 5 4 3 0 figure 3-17. halfword and signed data transfer with immediate offset and auto-indexing offsets and auto-indexing the offset from the base may be either a 8 -bit unsign ed binary immediate value in the instruction, or a second register. the 8-bit offset is formed by concatenating bits 11 to 8 and bits 3 to 0 of the instruction word, such that bit 11 becomes the msb and bit 0 becomes the lsb. the offset may be added to (u=1) or subtracted from (u=0) the base register rn. the offset modification may be performed either before (pre-indexed, p=1) or after (post-indexed, p=0) the base register is used as the transfer address. the w bit gives optional auto-increment and decrement addressing modes. the modified base value may be written back into the base (w=1), or the old base may be kept (w=0). in the case of post-indexed addressing, the write back bit is redundant and is always set to zero, since the old base value can be retained if necessary by setting the offset to zero. therefore post-indexed data transfers always write back the modified base. the write-back bit should not be set high (w=1) when post-indexed addressing is selected.
arm instruction set S3C2440a risc micr oprocessor 3- 36 halfword load and stores setting s=0 and h=1 may be used to transfer unsigned half-words between an arm920t register and memory. the action of ldrh and strh instructions is influenced by the bigend control signal. the two possible configurations are described in the section below. signed byte and halfword loads the s bit controls the loading of sign-extended data. when s=1 the h bit selects between bytes (h=0) and half- words (h=1). the l bit should not be set low (store) when signed (s=1) operations have been selected. the ldrsb instruction loads the selected byte into bits 7 to 0 of the destination register and bits 31 to 8 of the destination register are set to the value of bit 7, the sign bit. the ldrsh instruction loads the selected half-word into bits 15 to 0 of the destination register and bits 31 to 16 of the destination register are set to the value of bit 15, the sign bit. the action of the ldrsb and ldrsh instructions is influenced by the bigend control signal. the two possible configurations are described in the following section. endianness and byte/halfword selection little-endian configuration a signed byte load (ldrsb) expects data on data bus inputs 7 through to 0 if the supplied address is on a word boundary, on data bus inputs 15 through to 8 if it is a word address plus one byte, and so on. the selected byte is placed in the bottom 8 bit of the destination register, and the remaining bits of the register are filled with the sign bit, bit 7 of the byte. please see figure 2-2. a halfword load (ldrsh or ldrh) expects data on data bus inputs 15 through to 0 if the supplied address is on a word boundary and on data bus inputs 31 through to 16 if it is a halfword boundary, (a[1]=1).the supplied address should always be on a halfword boundary. if bit 0 of the supplied address is high then the arm920t will load an unpredictable value. the selected halfword is placed in the bottom 16 bits of the destination register. for unsigned half-words (ldrh), the top 16 bits of the register are filled with zeros and for signed half-words (ldrsh) the top 16 bits are filled with the sign bit, bit 15 of the halfword. a halfword store (strh) repeats the bottom 16 bits of the source register twice across the data bus outputs 31 through to 0. the external memory system should activate the appropriate halfword subsystem to store the data. note that the address must be halfword aligned, if bit 0 of the address is high this will cause unpredictable behaviour.
S3C2440a risc microprocessor arm instru ction set 3- 37 big-endian configuration a signed byte load (ldrsb) expects data on data bus inputs 31 through to 24 if the supplied address is on a word boundary, on data bus inputs 23 through to 16 if it is a word address plus one byte, and so on. the selected byte is placed in the bottom 8 bit of the destination register, and the remaining bits of the register are filled with the sign bit, bit 7 of the byte. please see figure 2-1. a halfword load (ldrsh or ldrh) expects data on data bus inputs 31 through to 16 if the supplied address is on a word boundary and on data bus inputs 15 through to 0 if it is a halfword boundary, (a[1]=1). the supplied address should always be on a halfword boundary. if bit 0 of the supplied address is high then the arm920t will load an unpredictable value. the selected halfword is placed in the bottom 16 bits of the destination register. for unsigned half-words (ldrh), the top 16 bits of the register are filled with zeros and for signed half-words (ldrsh) the top 16 bits are filled with the sign bit, bit 15 of the halfword. a halfword store (strh) repeats the bottom 16 bits of the source register twice across the data bus outputs 31 through to 0. the external memory system should activate the appropriate halfword subsystem to store the data. note please note that the address must be halfword aligned, if bit 0 of the address is high this will cause unpredictable behavior. use of r15 write-back should not be specified if r15 is specified as the base register (rn). while using r15 as the base register you must remember it contains address 8 bytes on from the address of the current instruction. r15 should not be specified as the register offset (rm). when r15 is the source register (rd) of a half-word store (strh) instruction, the stored address will be address of the instruction plus 12. data aborts a transfer to or from a legal address may cause problems for a memory management system. for instance, in a system which uses virtual memory the required data may be absent from the main memory. the memory manager can signal a problem by taking the processor abort input high whereupon the data abort trap will be taken. it is up to the system software to resolve the cause of the problem, then the instruction can be restarted and the original program continued. instruction cycle times normal ldr(h,sh,sb) instructions take 1s + 1n + 1i. ldr(h,sh,sb) pc take 2s + 2n + 1i incremental cycles. s,n and i are defined as sequential (s-cycle), non-sequential (n-cycle), and internal (i-cycle), respectively. strh instructions take 2n incremental cycles to execute.
arm instruction set S3C2440a risc micr oprocessor 3- 38 assembler syntax {cond} rd,
ldr load from memory into a register str store from a register into memory {cond} two-character condition mnemonic. see table 3-2. h transfer halfword quantity sb load sign extended byte (only valid for ldr) sh load sign extended halfword (only valid for ldr) rd an expression evaluating to a valid register number.
can be: 1 an expression which generates an address: the assembler will attempt to generate an instruction using the pc as a base and a corrected immediate offset to address the location given by evaluating the expression. this will be a pc relative, pre-indexed address. if the address is out of range, an error will be generated. 2 a pre-indexed addressing specification: [rn] offset of zero [rn,<#expression>]{!} offset of bytes [rn,{+/-}rm]{!} offset of +/- contents of index register 3 a post-indexed addressing specification: [rn],<#expression> offset of bytes [rn],{+/-}rm offset of +/- conten ts of index register. 4 rn and rm are expressions evaluating to a register number. if rn is r15 then the assembler will subtract 8 from the offset value to allow for arm920t pipelining. in this case base write-back should not be specified. {!} writes back the base register (set the w bit) if ! is present.
S3C2440a risc microprocessor arm instru ction set 3- 39 examples ldrh r1,[r2,-r3]! ; load r1 from the contents of the halfword address ; contained in r2-r3 (both of which are registers) ; and write back address to r2 strh r3,[r4,#14] ; store t he halfword in r3 at r14+14 but don't write back. ldrsb r8,[r2],#-223 ; load r8 with the sign extended contents of the byte ; address contained in r2 and write back r2-223 to r2. ldrnesh r11,[r0] ; conditionally load r11 with the sign extended contents ; of the halfword address contained in r0. here ; generate pc relative offset to address fred. strh r5, [pc,#(fred-here-8)]; store the halfword in r5 at address fred fred
arm instruction set S3C2440a risc micr oprocessor 3- 40 block data transfer (ldm, stm) the instruction is only executed if the condition is true. the various conditions are defined in table 3-2. the instruction encoding is shown in figure 3-18 . block data transfer instructions are used to load (ldm) or store (stm) any subset of the currently visible registers. they support all possible stacking modes, maintaining full or empty stacks which can grow up or down memory, and are very efficient instructions for saving or restoring context, or for moving large blocks of data around main memory. the register list the instruction can cause the transfer of any registers in the current bank (and non -user mode programs can also transfer to and from the user bank, see below). the register list is a 16 bit field in the instruction, with each bit corresponding to a register. a 1 in bit 0 of the register field will cause r0 to be transferred, a 0 will cause it not to be transferred; similarly bit 1 controls the transfer of r1, and so on. any subset of the registers, or all the registers, may be specified. the only restriction is that the register list should not be empty. whenever r15 is stored to memory the stored value is the address of the stm instruction plus 12. 31 27 19 15 cond 28 16 21 23 s 20 l rn [19:16] base register [20] load/store bit 0 = store to memory 1 = load from memory [21] write-back bit 0 = no write-back 1 = write address into base [22] psr & force user bit 0 = do not load psr or user mode 1 = load psr or force user mode [23] up/down bit 0 = down: subtract offset from base 1 = up: add offset to base [24] pre/post indexing bit 0 = post: add offset after transfer 1 = pre: add offset bofore transfer [31:28] condition field 22 100 p u w 24 25 register list 24 0 figure 3-18. block data transfer instructions
S3C2440a risc microprocessor arm instru ction set 3- 41 addressing modes the transfer addresses are determined by the contents of the base register (rn), the pre/post bit (p) and the up/ down bit (u). the registers are transferred in the order lowest to highest, so r15 (if in the list) will always be transferred last. the lowest register also gets transferred to/from the lowest memory address. by way of illustration, consider the transfer of r1, r5 and r7 in the case where rn=0x1000 and write back of the modified base is required (w=1). figure 3.19-22 show the sequence of register transfers, the addresses used, and the value of rn after the instruction has completed. in all cases, had write back of the modified base not been required (w=0), rn would have retained its initial value of 0x1000 unless it was also in the transfer list of a load multiple register instruction, when it would have been overwritten with the loaded value. (please check the meaning again)***** address alignment the address should normally be a word aligned quantity and non-word aligned addresses should not affect the instruction. however, the bottom 2 bits of the address will appear on a[1:0] and might be interpreted by the memory system. 1 2 3 4 rn r1 r1 r5 r1 r5 r7 rn 0x100c 0x1000 0x0ff4 0x100c 0x1000 0x0ff4 0x100c 0x1000 0x0ff4 0x100c 0x1000 0x0ff4 figure 3-19. post-increment addressing
arm instruction set S3C2440a risc micr oprocessor 3- 42 rn 1 r1 r1 2 r5 3 r1 r5 4 r7 rn 0x100c 0x1000 0x0ff4 0x100c 0x1000 0x0ff4 0x100c 0x1000 0x0ff4 0x100c 0x1000 0x0ff4 figure 3-20. pre-increment addressing rn 1 r1 r1 2 r5 3 r1 r5 4 r7 rn 0x100c 0x1000 0x0ff4 0x100c 0x1000 0x0ff4 0x100c 0x1000 0x0ff4 0x100c 0x1000 0x0ff4 figure 3-21. post-decrement addressing
S3C2440a risc microprocessor arm instru ction set 3- 43 rn 1 r1 r1 2 r5 3 r1 r5 4 r7 rn 0x100c 0x1000 0x0ff4 0x100c 0x1000 0x0ff4 0x100c 0x1000 0x0ff4 0x100c 0x1000 0x0ff4 figure 3-22. pre-decrement addressing use of the s bit when the s bit is set in a ldm/stm instruction it depends on r15 is available in the transfer list and on the type of instruction. the s bit should only be set if the instruction is to execute in a privileged mode. ldm with r15 in transfer list and s bit set (mode changes) if the instruction is a ldm then spsr_ is transferred to cpsr at the same time as r15 is loaded. stm with r15 in transfer list and s bit set (user bank transfer) the registers transferred are taken from the user bank rather than the bank corresponding to the current mode. this is useful for saving the user state on process switches. base write-back should not be used when this mechanism is employed. r15 not in list and s bit set (user bank transfer) for both ldm and stm instructions, the user bank registers are transferred rather than the register bank corresponding to the current mode. this is useful for saving the user state on process switches. base write-back should not be used when this mechanism is employed. when the instruction is ldm, care must be taken not to read from a banked register during the following cycle (inserting a dummy instruction such as mov r0, r0 after the ldm will ensure safety). use of r15 as the base r15 should not be used as the base register in any ldm or stm instruction.
arm instruction set S3C2440a risc micr oprocessor 3- 44 inclusion of the base in the register list when write-back is specified, the base is written back at the end of the second cycle of the instruction. during a stm, the first register is written out at the start of the second cycle. a stm which includes storing the base, with the base as the first register to be stored, will therefore store the unchanged value, whereas with the base second or later in the transfer order, will store the modified value. a ldm will always overwrite the updated base if the base is in the list. data aborts some legal addresses may be unacceptable to a memory management system, and the memory manager can indicate a problem with an address by taking the abort signal high. this can happen on any transfer during a multiple register load or store, and must be recoverable if arm920t is to be used in a virtual memory system. abort during stm instructions if the abort occurs during a store multiple instruction, arm920t takes little action until the instruction completes, whereupon it enters the data abort trap. the memory manager is responsible for preventing erroneous writes to the memory. the only change to the internal state of the processor will be the modification of the base register if write- back was specified, and this must be reversed by software (and the cause of the abort resolved) before the instruction may be retried. aborts during ldm instructions when arm920t detects a data abort during a load multiple instruction, it modifies the operation of the instruction to ensure that recovery is possible. overwriting of registers stops when the abort happens. the aborting load will not take place but earlier ones may have overwritten registers. the pc is always the last register to be written and so will always be preserved. the base register is restored, to its modified value if write-back was requested. this ensures recoverability in the case where the base register is also in the transfer list, and may have been overwritten before the abort occurred. the data abort trap is taken when the load multiple has completed, and the system software must undo any base modification (and resolve the cause of the abort) before restarting the instruction. instruction cycle times normal ldm instructions take ns + 1n + 1i and ldm pc takes (n+1)s + 2n + 1i incremental cycles, where s,n and i are defined as sequential (s-cycle), non-sequential (n-cycle), and internal (i-cycle), respectively. stm instructions take (n-1)s + 2n incremental cycles to execute, where n is the number of words transferred.
S3C2440a risc microprocessor arm instru ction set 3- 45 assembler syntax {cond} rn{!},{^} where: {cond} two character condition mnemonic. see table 3-2. rn an expression evaluating to a valid register number a list of registers and register ranges enclosed in {} (e.g. {r0,r2-r7,r10}). {!} if present requests write-back (w=1), otherwise w=0. {^} if present set s bit to load the cpsr along with the pc, or force transfer of user bank when in privileged mode. addressing mode names there are different assembler mnemonics for each of the addressing modes, depending on whether the instruction is being used to support stacks or for other purposes. the equivalence between the names and the values of the bits in the instruction are shown in the following table 3-6. table 3-6. addressing mode names name stack other l bit p bit u bit pre-increment load ldmed ldmib 1 1 1 post-increment load ldmfd ldmia 1 0 1 pre-decrement load ldmea ldmdb 1 1 0 post-decrement load ldmfa ldmda 1 0 0 pre-increment store stmfa stmib 0 1 1 post-increment store stmea stmia 0 0 1 pre-decrement store stmfd stmdb 0 1 0 post-decrement store stmed stmda 0 0 0 fd, ed, fa, ea define pre/post indexing and the up/down bit by reference to the form of stack required. the f and e refer to a "full" or "empty" stack, i.e. whether a pre-index has to be done (full) before storing to the stack. the a and d refer to whether the stack is ascending or descending. if ascending, a stm will go up and ldm down, if descending, vice-versa. ia, ib, da, db allow control when ldm/stm are not being used for stacks and simply mean increment after, increment before, decrement after, decrement before.
arm instruction set S3C2440a risc micr oprocessor 3- 46 examples ldmfd sp!,{r0,r1,r2} ; unstack 3 registers. stmia r0,{r0-r15} ; save all registers. ldmfd sp!,{r15} ; r15 ? (sp), cpsr unchanged. ldmfd sp!,{r15}^ ; r15 ? (sp), cpsr <- spsr_mode ; (allowed only in privileged modes). stmfd r13,{r0-r14}^ ; save user mode regs on stack ; (allowed only in privileged modes). these instructions may be used to save state on subroutine entry, and restore it efficiently on return to the calling routine: stmed sp!,{r0-r3,r14} ; save r0 to r3 to use as workspace ; and r14 for returning. bl somewhere ; this nested call will overwrite r14 ldmed sp!,{r0-r3,r15} ; restore workspace and return.
S3C2440a risc microprocessor arm instru ction set 3- 47 single data swap (swp) 31 19 15 cond 28 16 11 12 21 23 b 20 00 rn rd [3:0] source register [15:12] destination register [19:16] base register [22] byte/word bit 0 = swap word quantity 1 = swap word quantity [31:28] condition field 22 00010 0000 rm 1001 27 8 7 4 3 0 figure 3-23. swap instruction the instruction is only executed if the condition is true. the various conditions are defined in table 3-2. the instruction encoding is shown in figure 3-23. the data swap instruction is used to swap a byte or word quantity between a register and external memory. this instruction is implemented as a memory read followed by a memory write which are ?locked? together (the processor cannot be interrupted until both operations have completed, and the memory manager is warned to treat them as inseparable). this class of instruction is particularly useful for implementing software semaphores. the swap address is determined by the contents of the base register (rn). the processor first reads the contents of the swap address. then it writes the contents of the source register (rm) to the swap address, and stores the old memory contents in the destination register (rd). the same register may be specified as both the source and destination. the lock output goes high for the duration of the read and write operations to signal to the external memory manager that they are locked together, and should be allowed to complete without interruption. this is important in multi-processor systems where the swap instruction is the only indivisible instruction which may be used to implement semaphores; control of the memory must not be removed from a processor while it is performing a locked operation. bytes and words this instruction class may be used to swap a byte (b=1) or a word (b=0) between an arm920t register and memory. the swp instruction is implemented as a ldr followed by a str and the action of these is as described in the section on single data transfers. in particular, the description of big and little endian configuration applies to the swp instruction.
arm instruction set S3C2440a risc micr oprocessor 3- 48 use of r15 do not use r15 as an operand (rd, rn or rs) in a swp instruction. data aborts if the address used for the swap is unacceptable to a memory management system, the memory manager can flag the problem by driving abort high. this can happen on either the read or the write cycle (or both), and in either case, the data abort trap will be taken. it is up to the system software to resolve the cause of the problem, then the instruction can be restarted and the original program continued. instruction cycle times swap instructions take 1s + 2n +1i incremental cycles to execute, where s,n and i are defined as sequential (s-cycle), non-sequential, and internal (i-cycle), respectively. assembler syntax {cond}{b} rd,rm,[rn] {cond} two-character condition mnemonic. see table 3-2. {b} if b is present then byte transfer, otherwise word transfer rd,rm,rn expres sions evaluating to valid register numbers examples swp r0,r1,[r2] ; load r0 with the word addressed by r2, and ; store r1 at r2. swpb r2,r3,[r4] ; load r2 with the byte addressed by r4, and ; store bits 0 to 7 of r3 at r4. swpeq r0,r0,[r1] ; conditionally swap the contents of the ; word addressed by r1 with r0.
S3C2440a risc microprocessor arm instru ction set 3- 49 software interrupt (swi) the instruction is only executed if the condition is true. the various conditions are defined in table 3-2. the instruction encoding is shown in figure 3-24, below. 31 24 27 1111 cond comment field (ignored by processor) 28 23 [31:28] condition field 0 figure 3-24. software interrupt instruction the software interrupt instruction is used to enter supervisor mode in a controlled manner. the instruction causes the software interrupt trap to be taken, which effects the mode change. the pc is then forced to a fixed value (0x08) and the cpsr is saved in spsr_svc. if the swi vector address is suitably protected (by external memory management hardware) from modification by the user, a fully protected operating system may be constructed. return from the supervisor the pc is saved in r14_svc upon entering the software interrupt trap, with the pc adjusted to point to the word after the swi instruction. movs pc,r14_svc will return to the calling program and restore the cpsr. note that the link mechanism is not re-entrant, so if the supervisor code wishes to use software interrupts within itself it must first save a copy of the return address and spsr. comment field the bottom 24 bits of the instruction are ignored by the processor, and may be used to communicate information to the supervisor code. for instance, the supervisor may look at this field and use it to index into an array of entry points for routines which perform the various supervisor functions. instruction cycle times software interrupt instructions take 2s + 1n incremental cycles to execute, where s and n are defined as sequential (s-cycle) and non-sequential (n-cycle).
arm instruction set S3C2440a risc micr oprocessor 3- 50 assembler syntax swi{cond} {cond} two character condition mnemonic, table 3-2. evaluated and placed in the comment field (which is ignored by arm920t). examples swi readc ; get next character from read stream. swi writei+"k? ; output a "k" to the write stream. swine 0 ; conditionally call supervisor with 0 in comment field. supervisor code the previous examples assume that suitable supervisor code exists, for instance: 0x08 b supervisor ; swi entry point entrytable ; addresses of supervisor routines dcd zerortn dcd readcrtn dcd writeirtn zero equ 0 readc equ 256 writei equ 512 supervisor ; swi has routine required in bits 8-23 and data (if any) in ; bits 0-7. assumes r13_svc points to a suitable stack stmfd r13,{r0-r2,r14} ; save work registers and return address. ldr r0,[r14,#-4] ; get swi instruction. bic r0,r0,#0xff000000 ; clear top 8 bits. mov r1,r0,lsr#8 ; get routine offset. adr r2 ,entrytable ; get start address of entry table. ldr r15,[r2,r1,lsl#2] ; branch to appropriate routine. writeirtn ; enter with character in r0 bits 0-7. ldmfd r13,{r0-r2,r15}^ ; restore workspace and return, ; restoring processor mode and flags.
S3C2440a risc microprocessor arm instru ction set 3- 51 coprocessor data operations (cdp) the instruction is only executed if the condition is true. the various conditions are defined in table 3-2. the instruction encoding is shown in figure 3-25. this class of instruction is used to tell a coprocessor to perform some internal operation. no result is communicated back to arm920t, and it will not wait for the operation to complete. the coprocessor could contain a queue of such instructions awaiting execution, and their execution can overlap other activity, allowing the coprocessor and arm920t to perform independent tasks in parallel. coprocessor instructions the S3C2440a, unlike some other arm-based processors, does not have an external coprocessor interface. it does not have a on-chip coprocessor also. so then all coprocessor instructions will cause the undefined instruction trap to be taken on the S3C2440a. these coprocessor instructions can be emulated by the undefined trap handler. even though external coprocessor can not be connected to the S3C2440a, the coprocessor instructions are still described here in full for completeness. (remember that any external coprocessor described in this section is a software emulation.) 31 24 27 19 15 cond crm 28 16 11 12 23 20 [3:0] coprocessor operand register [7:5] coprocessor information [11:8] coprocessor number [15:12] coprocessor destination register [19:16] coprocessor operand register [23:20] coprocessor operation code [31:28] condition field 0 cp cp# crd crn 1110 cp opc 8 7 5 4 3 0 figure 3-25. coprocessor data operation instruction only bit 4 and bits 24 to 31 the coprocessor fields are significant to arm920t. the remaining bits are used by coprocessors. the above field names are used by convention, and particular coprocessors may redefine the use of all fields except cp# as appropriate. the cp# field is used to contain an identifying number (in the range 0 to 15) for each coprocessor, and a coprocessor will ignore any instruction which does not contain its number in the cp# field. the conventional interpretation of the instruction is that the coprocessor should perform an operation specified in the cp opc field (and possibly in the cp field) on the contents of crn and crm, and place the result in crd.
arm instruction set S3C2440a risc micr oprocessor 3- 52 instruction cycle times coprocessor data operations take 1s + bi incremental cycles to execute, where b is the number of cycles spent in the coprocessor busy-wait loop. s and i are defined as sequential (s-cycle) and internal (i-cycle). assembler syntax cdp{cond} p#,,cd,cn,cm{,} {cond} two character condition mnemonic. see table 3-2. p# the unique number of the required coprocessor evaluated to a constant and placed in the cp opc field cd, cn and cm evaluate to the valid coprocessor register numbers crd, crn and crm respectively where present is evaluated to a constant and placed in the cp field examples cdp p1,10,c1,c2,c3 ; request coproc 1 to do operation 10 ; on cr2 and cr3, a nd put the result in cr1. cdpeq p2,5,c1,c2,c3,2 ; if z flag is set request coproc 2 to do operation 5 (type 2) ; on cr2 and cr3, and put the result in cr1.
S3C2440a risc microprocessor arm instru ction set 3- 53 coprocessor data transfers (ldc, stc) the instruction is only executed if the condition is true. the various conditions are defined in table 3-2. the instruction encoding is shown in figure 3-26. this class of instruction is used to load (ldc) or store (stc) a subset of a coprocessors's registers directly to memory. arm920t is responsible for supplying the memory address and the coprocessor supplies or accepts the data and controls the number of words transferred. [7:0] unsigned 8 bit immediate offset [11:8] coprocessor number [15:12] coprocessor source/destination register [19:16] base register [20] load/store bit 0 = store to memory 1 = load from memory [21] write-back bit 0 = no write-back 1 = write address into base [22] transfer length [23] up/down bit 0 = down: subtract offset from base 1 = up: add offset to base [24] pre/post indexing bit 0 = post: add offset after transfer 1 = pre: add offset before transfer [31:28] condition field 31 27 19 15 cond 28 16 11 12 21 23 n 20 l rn crd 22 110 p u cp# w 24 25 offset 8 7 0 figure 3-26. coprocessor data transfer instructions
arm instruction set S3C2440a risc micr oprocessor 3- 54 the coprocessor fields the cp# field is used to identify the coprocessor which is required to supply or accept the data, and a coprocessor will only respond if its number matches the contents of this field. the crd field and the n bit contain information for the coprocessor which may be interpreted in different ways by different coprocessors, but by convention crd is the register to be transferred (or the first register where more than one is to be transferred), and the n bit is used to choose one of two transfer length options. for instance n=0 could select the transfer of a single register, and n=1 could select the transfer of all the registers for context switching. addressing modes arm920t is responsible for providing the address used by the memory system for the transfer, and the addressing modes available are a subset of those used in single data transfer instructions. note, however, that the immediate offsets are 8 bits wide and specify word offsets for coprocessor data transfers, whereas they are 12 bits wide and specify byte offsets for single data transfers. the 8 bit unsigned immediate offset is shifted left 2 bits and either added to (u=1) or subtracted from (u=0) the base register (rn); this calculation may be performed either before (p=1) or after (p=0) the base is used as the transfer address. the modified base value may be overwritten back into the base register (if w=1), or the old value of the base may be preserved (w=0). note that post-indexed addressing modes require explicit setting of the w bit, unlike ldr and str which always write-back when post-indexed. the value of the base register, modified by the offset in a pre-indexed instruction, is used as the address for the transfer of the first word. the second word (if more than one is transferred) will go to or come from an address one word (4 bytes) higher than the first transfer, and the address will be incremented by one word for each subsequent transfer. address alignment the base address should normally be a word aligned quantity. the bottom 2 bits of the address will appear on a[1:0] and might be interpreted by the memory system. use of r15 if rn is r15, the value used will be the address of the instruction plus 8 bytes. base write-back to r15 must not be specified. data aborts if the address is legal but the memory manager generates an abort, the data trap will be taken. the write-back of the modified base will take place, but all other processor state will be preserved. the coprocessor is partly responsible for ensuring that the data transfer can be restarted after the cause of the abort has been resolved, and must ensure that any subsequent actions it undertakes can be repeated when the instruction is retried. instruction cycle times coprocessor data transfer instructions take (n-1)s + 2n + bi incremental cycles to execute, where: n the number of words transferred. b the number of cycles spent in the coprocessor busy-wait loop. s, n and i are defined as sequential (s-cycle), non-sequential (n-cycle), and internal (i-cycle), respectively.
S3C2440a risc microprocessor arm instru ction set 3- 55 assembler syntax {cond}{l} p#,cd,
ldc load from memory to coprocessor stc store from coprocessor to memory {l} when present perform long transfer (n=1), otherwise perform short transfer (n=0) {cond} two character condition mnemonic. see table 3-2.. p# the unique number of the required coprocessor cd an expression evaluating to a valid coprocessor register number that is placed in the crd field
can be: 1 an expression which generates an address: the assembler will attempt to generate an instruction using the pc as a base and a corrected immediate offset to address the location given by evaluating the expression. this will be a pc relative, pre-indexe d address. if the address is out of range, an error will be generated 2 a pre-indexed addressing specification: [rn] offset of zero [rn,<#expression>]{!} offset of bytes 3 a post-indexed addressing specification: [rn],<#expression offset of bytes {!} write back the base register (set the w bit) if! is present rn is an expression evaluating to a valid arm920t register number. note if rn is r15, the assembler will subtract 8 from the offset value to allow for arm920t pipelining. examples ldc p1,c2,table ; load c2 of coproc 1 from address ; table, using a pc relative address. stceql p2,c3,[r5,#24]! ; conditionally store c3 of coproc 2 ; into an address 24 bytes up from r5, ; write this address back to r5, and use ; long transfer option (probably to store multiple words). note although the address offset is expressed in bytes, the instruction offset field is in words. the assembler will adjust the offset appropriately.
arm instruction set S3C2440a risc micr oprocessor 3- 56 coprocessor register transfers (mrc, mcr) the instruction is only executed if the condition is true. the various conditions are defined in table 3-2. the instruction encoding is shown in figure 3-27. this class of instruction is used to communicate information directly between arm920t and a coprocessor. an example of a coprocessor to arm920t register transfer (mrc) instruction would be a fix of a floating point value held in a coprocessor, where the floating point number is converted into a 32 bit integer within the coprocessor, and the result is then transferred to arm920t register. a float of a 32 bit value in arm920t register into a floating point value within the coprocessor illustrates the use of arm920t register to coprocessor transfer (mcr). an important use of this instruction is to communicate control information directly from the coprocessor into the arm920t cpsr flags. as an example, the result of a comparison of two floating point values within a coprocessor can be moved to the cpsr to control the subsequent flow of execution. 31 27 19 15 cond 28 16 11 12 21 23 20 l crn rd [3:0] coprocessor operand register [7:5] coprocessor information [11:8] coprocessor number [15:12] arm source/destination register [19:16] coprocessor source/destination register [20] load/store bit 0 = store to coprocessor 1 = load from coprocessor [21] coprocessor operation mode [31:28] condition field 1110 cp opc cp# 24 crm 1 cp 8 7 5 4 3 0 figure 3-27. coprocessor register transfer instructions the coprocessor fields the cp# field is used, as for all coprocessor instructions, to specify which coprocessor is being called upon. the cp opc, crn, cp and crm fields are used only by the coprocessor, and the interpretation presented here is derived from convention only. other interpretations are allowed where the coprocessor functionality is incompatible with this one. the conventional interpretation is that the cp opc and cp fields specify the operation the coprocessor is required to perform, crn is the coprocessor register which is the source or destination of the transferred information, and crm is a second coprocessor register which may be involved in some way which depends on the particular operation specified.
S3C2440a risc microprocessor arm instru ction set 3- 57 transfers to r15 when a coprocessor register transfer to arm920t has r15 as the destination, bits 31, 30, 29 and 28 of the transferred word are copied into the n, z, c and v flags respectively. the other bits of the transferred word are ignored, and the pc and other cpsr bits are unaffected by the transfer. transfers from r15 a coprocessor register transfer from arm920t with r15 as the source register will store the pc+12. instruction cycle times mrc instructions take 1s + (b+1)i +1c incremental cycles to execute, where s, i and c are defined as sequential (s-cycle), internal (i-cycle), and coprocessor register transfer (c-cycle), respectively. mcr instructions take 1s + bi +1c incremental cycles to execute, where b is the number of cycles spent in the coprocessor busy-wait loop. assembler syntax {cond} p#,,rd,cn,cm{,} mrc move from coprocessor to arm920t register (l=1) mcr move from arm920t register to coprocessor (l=0) {cond} two character condition mnemonic. see table 3-2 p# the unique number of the required coprocessor evaluated to a constant and placed in the cp opc field rd an expression evaluating to a valid arm9 20t register number cn and cm expressions evaluating to the valid coprocessor register numbers crn and crm respectively where present is evaluated to a constant and placed in the cp field examples mrc p2,5,r3,c5,c6 ; request coproc 2 to perform operation 5 ; on c5 and c6, and transfer the (single ; 32-bit word) result back to r3. mcr p6,0,r4,c5,c6 ; request coproc 6 to perform operation 0 ; on r4 and place the result in c6. mrceq p3,9,r3,c5,c6,2 ; conditionally request co proc 3 to ; perform operation 9 (type 2) on c5 and ; c6, and transfer the result back to r3.
arm instruction set S3C2440a risc micr oprocessor 3- 58 undefined instruction the instruction is only executed if the condition is true. the various conditions are defined in table 3-2. the instruction format is shown in figure 3-28. 31 27 cond 28 25 24 011 xxxxxxxxxxxxxxxxxxxx 1 xxxx 5 4 3 0 figure 3-28. undefined instruction if the condition is true, the undefined instruction trap will be taken. note that the undefined instruction mechanism involves offering this instruction to any coprocessors which may be present, and all coprocessors must refuse to accept it by driving cpa and cpb high. instruction cycle times this instruction takes 2s + 1i + 1n cycles, where s, n and i are defined as sequential (s-cycle), non-sequential (n- cycle), and internal (i-cycle). assembler syntax the assembler has no mnemonics for generating this instruction. if it is adopted in the future for some specified use, suitable mnemonics will be added to the assembler. until such time, this instruction must not be used.
S3C2440a risc microprocessor arm instru ction set 3- 59 instruction set examples the following examples show ways in which the basic arm920t instructions can combine to give efficient code. none of these methods saves a great deal of execution time (although they may save some), mostly they just save code. using the conditional instructions using conditionals for logical or cmp rn,#p ; if rn=p or rm=q then goto label. beq label cmp rm,#q beq label this can be replaced by cmp rn,#p cmpne rm,#q ; if condition not satisfied try other test. beq label absolute value teq rn,#0 ; test sign rsbmi rn,rn,#0 ; and 2's complement if necessary. multiplication by 4, 5 or 6 (run time) mov rc,ra,lsl#2 ; multiply by 4, cmp rb,#5 ; test value, addcs rc,rc,ra ; complete multiply by 5, addhi rc,rc,ra ; complete multiply by 6. combining discrete and range tests teq rc,#127 ; discrete test, cmpne rc,# " "-1 ; range test movls rc,# "" ; if rc<= "" or rc=ascii(127) ; then rc:= "."
arm instruction set S3C2440a risc micr oprocessor 3- 60 division and remainder a number of divide routines for specific applications are provided in source form as part of the ansi c library provided with the arm cross development toolkit, available from your supplier. a short general purpose divide routine follows. ; enter with numbers in ra and rb. mov rcnt,#1 ; bit to control the division. div1 cmp rb,#0x80000000 ; move rb until greater than ra. cmpcc rb,ra movcc rb,rb,asl#1 movcc rcnt,rcnt,asl#1 bcc div1 mov rc,#0 div2 cmp ra,rb ; test for possible subtraction. subcs ra,ra,rb ; subtract if ok, addcs rc,rc,rcnt ; put relevan t bit into result movs rcnt,rcnt,lsr#1 ; shift control bit movne rb,rb,lsr#1 ; halve unless finished. bne div2 ; divide result in rc, remainder in ra. overflow detection in the arm920t 1. overflow in unsigned multiply with a 32-bit result umull rd,rt,rm,rn ; 3 to 6 cycles teq rt,#0 ; +1 cycle and a register bne overflow 2. overflow in signed multiply with a 32-bit result smull rd,rt,rm,rn ; 3 to 6 cycles teq rt,rd asr#31 ; +1 cycle and a register bne overflow 3. overflow in unsigned multiply ac cumulate with a 32 bit result umlal rd,rt,rm,rn ; 4 to 7 cycles teq rt,#0 ; +1 cycle and a register bne overflow 4. overflow in signed multiply accumulate with a 32 bit result smlal rd,rt,rm,rn ; 4 to 7 cycles teq rt,rd, asr#31 ; +1 cycle and a register bne overflow
S3C2440a risc microprocessor arm instru ction set 3- 61 5. overflow in unsigned multiply accumulate with a 64 bit result umull rl,rh,rm,rn ; 3 to 6 cycles adds rl,rl,ra1 ; lower accumulate adc rh,rh,ra2 ; upper accumulate bcs overflow ; 1 cycle and 2 registers 6. overflow in signed mult iply accumulate with a 64 bit result smull rl,rh,rm,rn ; 3 to 6 cycles adds rl,rl,ra1 ; lower accumulate adc rh,rh,ra2 ; upper accumulate bvs overflow ; 1 cycle and 2 registers note overflow checking is not applicable to unsigned and signed multiplies with a 64-bit result, since overflow does not occur in such calculations. pseudo-random binary sequence generator it is often necessary to generate (pseudo-) random numbers and the most efficient algorithms are based on shift generators with exclusive-or feedback rather like a cyclic redundancy check generator. unfortunately the sequence of a 32 bit generator needs more than one feedback tap to be maximal length (i.e. 2^32-1 cycles before repetition), so this example uses a 33 bit register with taps at bits 33 and 20. the basic algorithm is newbit:=bit 33 eor bit 20, shift left the 33 bit number and put in newbit at the bottom; this operation is performed for all the newbits needed (i.e. 32 bits). the entire operation can be done in 5 s cycles: ; enter w ith seed in ra (32 bits), ; rb (1 bit in rb lsb), uses rc. tst rb,rb,lsr#1 ; top bit into carry movs rc,ra,rrx ; 33 bit rotate right adc rb,rb,rb ; carry into lsb of rb eor rc,rc,ra,lsl#12 ; (involved!) eor ra,rc,rc,lsr#20 ; (similarly involved!) new seed in ra, rb as before multiplication by constant using the barrel shifter multiplication by 2^n (1,2,4,8,16,32..) mov ra, rb, lsl #n multiplication by 2^n+1 (3,5,9,17..) add ra,ra,ra,lsl #n multiplication by 2^n-1 (3,7,15..) rsb ra,ra, ra,lsl #n
arm instruction set S3C2440a risc micr oprocessor 3- 62 multiplication by 6 add ra,ra,ra,lsl #1 ; multiply by 3 mov ra,ra,lsl#1 ; and then by 2 multiply by 10 and add in extra number add ra,ra,ra,lsl#2 ; multiply by 5 add ra,rc,ra,lsl#1 ; multiply by 2 and add in next digit general recursive method for rb := ra*c, c a constant: 1. if c even, say c = 2^n*d, d odd: d=1: mov rb,ra,lsl #n d<>1: {rb := ra*d} mov rb,rb,lsl #n 2. if c mod 4 = 1, say c = 2^n*d+1, d odd, n>1: d=1: add rb,ra,ra,lsl #n d<>1: {rb := ra*d} add rb,ra,rb,lsl #n 3. if c mod 4 = 3, say c = 2^n*d-1, d odd, n>1: d=1: rsb rb,ra,ra,lsl #n d<>1: {rb := ra*d} rsb rb,ra,rb,lsl #n this is not quite optimal, but close. an example of its non-optimality is multiply by 45 which is done by: rsb rb,ra,ra,lsl#2 ; multiply by 3 rsb rb,ra,rb,lsl#2 ; multiply by 4*3-1 = 11 add rb,ra,rb,lsl# 2 ; multiply by 4*11+1 = 45 rather than by: add rb,ra,ra,lsl#3 ; multiply by 9 add rb,rb,rb,lsl#2 ; multiply by 5*9 = 45
S3C2440a risc microprocessor arm instru ction set 3- 63 loading a word from an unknown alignment ; enter with add ress in ra (32 bits) uses ; rb, rc result in rd. note d must be less than c e.g. 0,1 bic rb,ra,#3 ; get word aligned address ldmia rb,{rd,rc} ; get 64 bits containing answer and rb,ra,#3 ; correction factor in bytes movs rb,rb,lsl#3 ; ...now in bits and test if aligned movne rd,rd,lsr rb ; produce bottom of result word (if not aligned) rsbne rb,rb,#32 ; get other shift amount orrne rd,rd,rc,lsl rb ; combine two halves to get result
arm instruction set S3C2440a risc micr oprocessor 3- 64 notes
S3C2440a risc microprocessor thumb inst ruction set 4- 1 4 thumb instruction s et thumb instruction set format the thumb instruction sets are 16-bit versions of arm instruction sets (32-bit format). the arm instructions are reduced to 16-bit versions.thumb instructions, at the cost of versatile functions of the arm instruction sets. the thumb instructions are decompressed to the arm instructions by the thumb decompressor inside the arm920t core. as the thumb instructions are compressed arm instructions, the thumb instructions have the 16-bit format instructions and have some restrictions. the restriction by 16-bit format is fully notified for using the thumb instructions.
thumb instruction set S3C2440a risc mi croprocessor 4- 2 format summary the thumb instruction set formats are shown in the following figure. move shifted register 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 0 l 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 0 0 1 0 0 l 1 0 r 1 1 0 1 0 sp 1 l l s h 0 0 1 b l 0 1 h 0 1 b 0 0 1 1 1 i op op op op op l 0 s 1 offset5 rs rd rn/offset3 rd rs rd offset8 rs rd/hd rd h1 h2 rs/hs rd word8 rd rb ro ro rb rd offset5 rb rd rb rd offset5 rd rd word8 word8 sword7 rb cond rlist rlist softset8 value8 offset11 offset add/subtract move/compare/add/ subtract immediate alu operations hi register operations /branch exchange pc-relative load load/store with register offset load/store with immediate offset load/store sign-extended byte/halfword load/store halfword sp-relative load/store load address add offset to stack pointer push/pop register multiple load/store conditional branch software interrupt unconditional branch long branch with link 15 14 13 12 11 10 9 8 7 6 5 4 2 3 1 0 15 14 13 12 11 10 9 8 7 6 5 4 2 3 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 figure 4-1. thumb instruction set formats
S3C2440a risc microprocessor thumb inst ruction set 4- 3 opcode summary the following table summarizes the thumb instruction set. for further information about a particular instruction please refer to the sections listed in the right-most column. table 4-1. thumb instruction set opcodes mnemonic instruction lo-register operand hi-register operand condition codes set adc add with carry y ? y add add y ? y (1) and and y ? y asr arithmetic shift right y ? y b unconditional branch y ? ? bxx conditional branch y ? ? bic bit clear y ? y bl branch and link ? ? ? bx branch and exchange y y ? cmn compare negative y ? y cmp compare y y y eor eor y ? y ldmia load multiple y ? ? ldr load word y ? ? ldrb load byte y ? ? ldrh load halfword y ? ? lsl logical shift left y ? y ldsb load sign-extended byte y ? ? ldsh load sign-extended halfword y ? ? lsr logical shift right y ? y mov move register y y y (2) mul multiply y ? y mvn move negative register y ? y
thumb instruction set S3C2440a risc mi croprocessor 4- 4 table 4-1. thumb instruction set opcodes (continued) mnemonic instruction lo-register operand hi-register operand condition codes set neg negate y ? y orr or y ? y pop pop register y ? ? push push register y ? ? ror rotate right y ? y sbc subtract with carry y ? y stmia store multiple y ? ? str store word y ? ? strb store byte y ? ? strh store halfword y ? ? swi software interrupt ? ? ? sub subtract y ? y tst test bits y ? y notes: 1. the condition codes are unaffected by the format 5, 12 and 13 versions of this instruction. 2. the condition code s are unaffected by the format 5 version of this instruction.
S3C2440a risc microprocessor thumb inst ruction set 4- 5 format 1: move shifted register 15 0 0 14 10 [2:0] destination register [5:3] source register [10:6] immediate vale [12:11] opcode 0 = lsl 1 = lsr 2 = asr offset5 6 5 3 2 rd 0 0 13 12 11 op rs figure 4-2. format 1 operation these instructions move a shifted value between lo registers. the thumb assembler syntax is shown in table 4-2. note all instructions in this group set the cpsr condition codes. table 4-2. summary of format 1 instructions op thumb assembler arm equipment action 00 lsl rd, rs, #offset5 movs rd, rs, lsl #offset5 shift rs left by a 5-bit immediate value and store the result in rd. 01 lsr rd, rs, #offset5 movs rd, rs, lsr #offset5 perform logical shift right on rs by a 5-bit immediate value and store the result in rd. 10 asr rd, rs, #offset5 movs rd, rs, asr #offset5 perform arithmetic shift right on rs by a 5-bit immediate value and store the result in rd.
thumb instruction set S3C2440a risc mi croprocessor 4- 6 instruction cycle times all instructions in this format have an equivalent arm instruction as shown in table 4-2. the instruction cycle times for the thumb instruction are identical to that of the equivalent arm instruction. examples lsr r2, r5, #27 ; logical shift right the contents of r5 by 27 and store the result in r2.set condition codes on the result.
S3C2440a risc microprocessor thumb inst ruction set 4- 7 format 2: add/subtract 15 0 14 10 [2:0] destination register [5:3] source register [8:6] register/immediate vale [9] opcode 0 = add 1 = sub [10] immediate flag 0 = register operand 1 = immediate oerand rn/offset3 rd 0 0 13 12 11 op rs 9 8 1 1 1 6 5 3 2 0 figure 4-3. format 2 operation these instructions allow the contents of a lo register or a 3-bit immediate value to be added to or subtracted from a lo register. the thumb assembler syntax is shown in table 4-3. note all instructions in this group set the cpsr condition codes. table 4-3. summary of format 2 instructions op i thumb assembler arm equipment description 0 0 add rd, rs, rn adds rd, rs, rn add contents of rn to contents of rs. place result in rd. 0 1 add rd, rs, #offset3 adds rd, rs, #offset3 add 3-bit immediate value to contents of rs. place result in rd. 1 0 sub rd, rs, rn subs rd, rs, rn subtract contents of rn from contents of rs. place result in rd. 1 1 sub rd, rs, #offset3 subs rd, rs, #offset3 subtract 3-bit immediate value from contents of rs. place result in rd.
thumb instruction set S3C2440a risc mi croprocessor 4- 8 instruction cycle times all instructions in this format have an equivalent arm instruction as shown in table 4-3. the instruction cycle times for the thumb instruction are identical to that of the equivalent arm instruction. examples add r0, r3, r4 ; r0 := r3 + r4 and set condition codes on the result. sub r6, r2, #6 ; r6 := r2 - 6 and set condition codes.
S3C2440a risc microprocessor thumb inst ruction set 4- 9 format 3: move/compare/add/subtract immediate 15 0 0 14 10 [7:0] immediate vale [10:8] source/destination register [12:11] opcode 0 = mov 1 = cmp 2 = add 3 = sub offset8 rd 0 0 13 12 11 op 7 8 figure 4-4. format 3 operations the instructions in this group perform operations between a lo register and an 8-bit immediate value. the thumb assembler syntax is shown in table 4-4. note all instructions in this group set the cpsr condition codes. table 4-4. summary of format 3 instructions op thumb assembler arm equipment description 00 mov rd, #offset8 movs rd, #offset8 move 8-bit immediate value into rd. 01 cmp rd, #offset8 cmp rd, #offset8 compare contents of rd with 8-bit immediate value. 10 add rd, #offset8 adds rd, rd, #offset8 add 8-bit immediate value to contents of rd and place the result in rd. 11 sub rd, #offset8 subs rd, rd, #offset8 subtract 8-bit immediate value from contents of rd and place the result in rd.
thumb instruction set S3C2440a risc mi croprocessor 4- 10 instruction cycle times all instructions in this format have an equivalent arm instruction as shown in table 4-4. the instruction cycle times for the thumb instruction are identical to that of the equivalent arm instruction. examples mov r0, #128 ; r0 := 128 and set condition codes cmp r2, #62 ; set condit ion codes on r2 - 62 add r1, #255 ; r1 := r1 + 255 and set condition codes sub r6, #145 ; r6 := r6 - 145 and set condition codes
S3C2440a risc microprocessor thumb inst ruction set 4- 11 format 4: alu operations 15 0 0 14 10 [2:0] source/destination register [5:3] source register 2 [9:6] opcode 5 6 3 rd 0 0 13 12 11 op rs 0 0 0 9 2 figure 4-5. format 4 operation the following instructions perform alu operations on a lo register pair. note all instructions in this group set the cpsr condition codes. table 4-5. summary of format 4 instructions op thumb assembler arm equipment description 0000 and rd, rs ands rd, rd, rs rd := rd and rs 0001 eor rd, rs eors rd, rd, rs rd := rd eor rs 0010 lsl rd, rs movs rd, rd, lsl rs rd := rd << rs 0011 lsr rd, rs movs rd, rd, lsr rs rd := rd >> rs 0100 asr rd, rs movs rd, rd, asr rs rd := rd asr rs 0101 adc rd, rs adcs rd, rd, rs rd := rd + rs + c-bit 0110 sbc rd, rs sbcs rd, rd, rs rd := rd - rs - not c-bit 0111 ror rd, rs movs rd, rd, ror rs rd := rd ror rs 1000 tst rd, rs tst rd, rs set condition codes on rd and rs 1001 neg rd, rs rsbs rd, rs, #0 rd = ? rs 1010 cmp rd, rs cmp rd, rs set condition codes on rd ? rs 1011 cmn rd, rs cmn rd, rs set condition codes on rd + rs 1100 orr rd, rs orrs rd, rd, rs rd := rd or rs 1101 mul rd, rs muls rd, rs, rd rd := rs * rd 1110 bic rd, rs bics rd, rd, rs rd := rd and not rs 1111 mvn rd, rs mvns rd, rs rd := not rs
thumb instruction set S3C2440a risc mi croprocessor 4- 12 instruction cycle times all instructions in this format have an equivalent arm instruction as shown in table 4-5. the instruction cycle times for the thumb instruction are identical to that of the equivalent arm instruction. examples eor r3, r4 ; r3 := r3 eor r4 and set condition codes ror r1, r0 ; rotate right r1 by the value in r0, store ; the result in r1 and set condition codes neg r5, r3 ; subtract the contents of r3 from zero, ; store the result in r5. set condition codes ie r5 = ? r 3 cmp r2, r6 ; set the condition codes on the result of r2 - r6 mul r0, r7 ; r0 := r7 r0 and set condition codes
S3C2440a risc microprocessor thumb inst ruction set 4- 13 format 5: hi-register operations/branch exchange 15 0 0 14 10 [2:0] destination register [5:3] source register [6] hi operand flag 2 [7] hi operand flag 1 [9:8] opcode 6 5 3 2 rd/hd 0 0 13 12 11 op rs/hs 0 0 0 9 8 7 h1 h2 figure 4-6. format 5 operation there are four sets of instructions in this group. the first three allow add, cmp and mov operations to be performed between lo and hi registers, or a pair of hi registers. the fourth, bx, allows a branch to be performed which may also be used to switch processor state. the thumb assembler syntax is shown in table 4-6. note in this group only cmp (op = 01) sets the cpsr condition codes. the action of h1= 0, h2 = 0 for op = 00 (add), op =01 (cmp) and op = 10 (mov) is undefined, and should not be used. table 4-6. summary of format 5 instructions op h1 h2 thumb assembler arm equivalent description 00 0 1 add rd, hs add rd, rd, hs add a register in the range 8-15 to a register in the range 0-7. 00 1 0 add hd, rs add hd, hd, rs add a register in the range 0-7 to a register in the range 8-15. 00 1 1 add hd, hs add hd, hd, hs add two registers in the range 8-15 01 0 1 cmp rd, hs cmp rd, hs compare a register in the range 0-7 with a register in the range 8-15. set the condition code flags on the result. 01 1 0 cmp hd, rs cmp hd, rs compare a register in the range 8-15 with a register in the range 0-7. set the condition code flags on the result.
thumb instruction set S3C2440a risc mi croprocessor 4- 14 table 4-6. summary of format 5 instructions (continued) op h1 h2 thumb assembler arm equivalent description 01 1 1 cmp hd, hs cmp hd, hs compare two registers in the range 8-15. set the condition code flags on the result. 10 0 1 mov rd, hs mov rd, hs move a value from a register in the range 8-15 to a register in the range 0- 7. 10 1 0 mov hd, rs mov hd, rs move a value from a register in the range 0-7 to a register in the range 8-15. 10 1 1 mov hd, hs mov hd, hs move a value between two registers in the range 8-15. 11 0 0 bx rs bx rs perform branch (plus optional state change) to address in a register in the range 0-7. 11 0 1 bx hs bx hs perform branch (plus optional state change) to address in a register in the range 8-15. instruction cycle times all instructions in this format have an equivalent arm instruction as shown in table 4-6. the instruction cycle times for the thumb instruction are identical to that of the equivalent arm instruction. the bx instruction bx performs a branch to a routine whose start address is specified in a lo or hi register. bit 0 of the address determines the processor state on entry to the routine: bit 0 = 0 causes the processor to enter arm state. bit 0 = 1 causes the processor to enter thumb state. note the action of h1 = 1 for this instruction is undefined, and should not be used.
S3C2440a risc microprocessor thumb inst ruction set 4- 15 examples hi-register operations add pc, r5 ; pc := pc + r5 but don't set the condition codes. cmp r4, r12 ; set the condition codes on the result of r4 - r12. mov r15, r14 ; move r14 (lr) into r15 (pc) but don't set the condition codes, eg. return from subroutine. branch and exchange ; switch from thumb to arm state. adr r1,outofthumb ; load address of outofthumb into r1. mov r11,r1 bx r11 ; transfer the contents of r11 into the pc. ; bit 0 of r11 determines whethe r ; arm or thumb state is entered, ie. in this case the state is arm. align code32 outofthumb ; now processing arm instructions... using r15 as an operand if r15 is used as an operand, the value will be the address of the instruction + 4 with bit 0 cleared. executing a bx pc in thumb state from a non-word aligned address will result in unpredictable execution.
thumb instruction set S3C2440a risc mi croprocessor 4- 16 format 6: pc-relative load 15 0 0 14 10 [7:0] immediate value [10:8] destination register word 8 0 0 13 12 11 rd 0 0 8 7 figure 4-7. format 6 operation this instruction loads a word from an address specified as a 10-bit immediate offset from the pc. the thumb assembler syntax is shown below. table 4-7. summary of pc-relative load instruction thumb assembler arm equivalent description ldr rd, [pc, #imm] ldr rd, [r15, #imm] add unsigned offset (255 words, 1020 bytes) in imm to the current value of the pc. load the word from the resulting address into rd. note: the value specified by #imm is a full 10-bit address, but must always be word-aligned (ie with bits 1:0 set to 0), since the assembler place s #imm >> 2 in field word 8. the value of the pc will be 4 bytes greater than the address of this instruction, but bit 1 of the pc is forced to 0 to ensure it is word aligned.
S3C2440a risc microprocessor thumb inst ruction set 4- 17 instruction cycle times all instructions in this format have an equivalent arm instruction. the instruction cycle times for the thumb instruction are identical to that of the equivalent arm instruction. examples ldr r3,[pc,#844] ; load into r3 the word found at the address formed by adding 844 to pc.bit[1] of pc is forced to zero. note that the thumb opcode will contain 211 as the word8 value.
thumb instruction set S3C2440a risc mi croprocessor 4- 18 format 7: load/store with register offset [2:0] source/destination register [5:3] base register [8:6] offset register [10] byte/word flag 0 = transfer word quantity 1 = transfer byte quantity [11] load/store flag 0 = store to memory 1 = load from memory 15 0 0 14 10 6 5 3 2 rd 1 0 13 12 11 rb 1 l b 9 8 ro 0 figure 4-8. format 7
S3C2440a risc microprocessor thumb inst ruction set 4- 19 operation these instructions transfer byte or word values between registers and memory. memory addresses are pre-indexed using an offset register in the range 0-7. the thumb assembler syntax is shown in table 4-8. table 4-8. summary of format 7 instructions l b thumb assembler arm equivalent description 0 0 str rd, [rb, ro] str rd, [rb, ro] pre-indexed word store: calculate the target address by adding together the value in rb and the value in ro. store the contents of rd at the address. 0 1 strb rd, [rb, ro] strb rd, [rb, ro] pre-indexed byte store: calculate the target address by adding together the value in rb and the value in ro. store the byte value in rd at the resulting address. 1 0 ldr rd, [rb, ro] ldr rd, [rb, ro] pre-indexed word load: calculate the source address by adding together the value in rb and the value in ro. load the contents of the address into rd. 1 1 ldrb rd, [rb, ro] ldrb rd, [rb, ro] pre-indexed byte load: calculate the source address by adding together the value in rb and the value in ro. load the byte value at the resulting address. instruction cycle times all instructions in this format have an equivalent arm instruction as shown in table 4-8. the instruction cycle times for the thumb instruction are identical to that of the equivalent arm instruction. examples str r3, [r2,r6] ; store word in r3 at the address formed by adding r6 to r2. ldrb r2, [r0,r7] ; load into r2 the byte found at the address formed by adding r7 to r0.
thumb instruction set S3C2440a risc mi croprocessor 4- 20 format 8: load/store sign-extended byte/halfword [2:0] destination register [5:3] base register [8:6] offset register [10] sign-extended flag 0 = operand not sing-extended 1 = operand sing-extended [11] h flag 15 0 0 14 10 6 5 3 2 rd 1 0 13 12 11 rb 1 h s 9 8 ro 1 figure 4-9. format 8 operation these instructions load optionally sign-extended bytes or halfwords, and store halfwords. the thumb assembler syntax is shown below. table 4-9. summary of format 8 instructions l b thumb assembler arm equivalent description 0 0 strh rd, [rb, ro] strh rd, [rb, ro] store halfword: add ro to base address in rb. store bits 0-15 of rd at the resulting address. 0 1 ldrh rd, [rb, ro] ldrh rd, [rb, ro] load halfword: add ro to base address in rb. load bits 0-15 of rd from the resulting address, and set bits 16-31 of rd to 0. 1 0 ldsb rd, [rb, ro] ldrsb rd, [rb, ro] load sign-extended byte: add ro to base address in rb. load bits 0-7 of rd from the resulting address, and set bits 8-31 of rd to bit 7. 1 1 ldsh rd, [rb, ro] ldrsh rd, [rb, ro] load sign-extended halfword: add ro to base address in rb. load bits 0-15 of rd from the resulting address, and set bits 16-31 of rd to bit 15.
S3C2440a risc microprocessor thumb inst ruction set 4- 21 instruction cycle times all instructions in this format have an equivalent arm instruction as shown in table 4-9. the instruction cycle times for the thumb instruction are identical to that of the equivalent arm instruction. examples strh r4, [r3, r0] ; store the lower 16 bits of r4 at the address formed by adding r0 to r3. ldsb r2, [r7, r1] ; load into r2 the sign extended byte found at the address formed by adding r1 to r7. ldsh r3, [r4, r2] ; load into r3 the sign extended halfword found at the address formed by adding r2 to r4.
thumb instruction set S3C2440a risc mi croprocessor 4- 22 format 9: load/store with immediate offset [2:0] source/destination register [5:3] base register [10:6] offset register [11] load/store flag 0 = store to memory 1 = load from memory [12] byte/word flad 0 = transfer word quantity 1 = transfer byte quantity 15 0 0 14 10 6 5 3 2 rd 1 1 13 12 11 rb b l offset5 figure 4-10. format 9
S3C2440a risc microprocessor thumb inst ruction set 4- 23 operation these instructions transfer byte or word values between registers and memory using an immediate 5 or 7-bit offset. the thumb assembler syntax is shown in table 4-10. table 4-10. summary of format 9 instructions l b thumb assembler arm equivalent description 0 0 str rd, [rb, #imm] str rd, [rb, #imm] calculate the target address by adding together the value in rb and imm. store the contents of rd at the address. 1 0 ldr rd, [rb, #imm] ldr rd, [rb, #imm] calculate the source address by adding together the value in rb and imm. load rd from the address. 0 1 strb rd, [rb, #imm] strb rd, [rb, #imm] calculate the target address by adding together the value in rb and imm. store the byte value in rd at the address. 1 1 ldrb rd, [rb, #imm] ldrb rd, [rb, #imm] calculate source address by adding together the value in rb and imm. load the byte value at the address into rd. note: for word accesses (b = 0), the value specified by #imm is a full 7-bit address, but must be word-aligned (ie with bits 1:0 set to 0), since the assembler places #imm >> 2 in the offset5 field. instruction cycle times all instructions in this format have an equivalent arm instruction as shown in table 4-10. the instruction cycle times for the thumb instruction are identical to that of the equivalent arm instruction. examples ldr r2, [r5,#116] ; load into r2 the word found at the address formed by adding 116 to r5.note that the thumb opcode will contain 29 as the offset5 value. strb r1, [r0,#13] ; store the lower 8 bits of r1 at the address formed by adding 13 to r0.note that the thumb opcode will contain 13 as the offset5 value.
thumb instruction set S3C2440a risc mi croprocessor 4- 24 format 10: load/store halfword [2:0] source/destination register [5:3] base register [10:6] immediate value [11] load/store flag 0 = store to memory 1 = load from memory 15 0 0 14 10 6 5 3 2 rd 1 0 13 12 11 rb 0 l offset5 figure 4-11. format 10 operation these instructions transfer halfword values between a lo register and memory. addresses are pre-indexed, using a 6-bit immediate value. the thumb assembler syntax is shown in table 4-11. table 4-11. halfword data transfer instructions l thumb assembler arm equivalent description 0 strh rd, [rb, #imm] strh rd, [rb, #imm] add #imm to base address in rb and store bits 0 - 15 of rd at the resulting address. 1 ldrh rd, [rb, #imm] ldrh rd, [rb, #imm] add #imm to base address in rb. load bits 0-15 from the resulting address into rd and set bits 16-31 to zero. note: #imm is a full 6-bit address but must be halfword-aligned (ie with bit 0 set to 0) since the assembler places #imm >> 1 in the offset5 field.
S3C2440a risc microprocessor thumb inst ruction set 4- 25 instruction cycle times all instructions in this format have an equivalent arm instruction as shown in table 4-11. the instruction cycle times for the thumb instruction are identical to that of the equivalent arm instruction. examples strh r6, [r1, #56] ; store the lower 16 bits of r4 at th e address formed by adding 56 r1. note that the thumb opcode will contain 28 as the offset5 value. ldrh r4, [r7, #4] ; load into r4 the halfword found at the address formed by adding 4 to r7. note that the thumb opcode will contain 2 as the offset5 value.
thumb instruction set S3C2440a risc mi croprocessor 4- 26 format 11: sp-relative load/store [7:0] immediate value [10:8] destination register [11] load/store bit 0 = store to memory 1 = load from memory 15 0 1 14 10 0 0 13 12 11 word 8 1 l rd 7 8 figure 4-12. format 11 operation the instructions in this group perform an sp-relative load or store. the thumb assembler syntax is shown in the following table. table 4-12. sp-relative load/store instructions l thumb assembler arm equivalent description 0 str rd, [sp, #imm] str rd, [r13 #imm] add unsigned offset (255 words, 1020 bytes) in imm to the current value of the sp (r7). store the contents of rd at the resulting address. 1 ldr rd, [sp, #imm] ldr rd, [r13 #imm] add unsigned offset (255 words, 1020 bytes) in imm to the current value of the sp (r7). load the word from the resulting address into rd. note: the offset supplied in #imm is a full 10-bit address, but must always be word-aligned (ie bits 1:0 set to 0), since the assembler places #imm >> 2 in the word8 field.
S3C2440a risc microprocessor thumb inst ruction set 4- 27 instruction cycle times all instructions in this format have an equivalent arm instruction as shown in table 4-12. the instruction cycle times for the thumb instruction are identical to that of the equivalent arm instruction. examples str r4, [sp,#492] ; store the contents of r4 at the address f ormed by adding 492 to sp (r13).note that the thumb opcode will contain 123 as the word8 value.
thumb instruction set S3C2440a risc mi croprocessor 4- 28 format 12: load address [7:0] 8-bit unsigned constant [10:8] destination register [11] source 0 = pc 1 = sp 15 0 1 14 10 0 1 13 12 11 word 8 0 sp rd 7 8 figure 4-13. format 12 operation these instructions calculate an address by adding a 10-bit constant to either the pc or the sp, and load the resulting address into a register. the thumb assembler syntax is shown in the following table. table 4-13. load address l thumb assembler arm equivalent description 0 add rd, pc, #imm add rd, r15, #imm add #imm to the current value of the program counter (pc) and load the result into rd. 1 add rd, sp, #imm add rd, r13, #imm add #imm to the current value of the stack pointer (sp) and load the result into rd. note: the value specified by #imm is a full 10-bit value, but this must be word-aligned (ie with bits 1:0 set to 0) since the assembler places #imm >> 2 in field word 8. where the pc is used as the source register (sp = 0), bit 1 of the pc is always read as 0. the value of the pc will be 4 bytes greater than the address of the instruction before bit 1 is forced to 0. the cpsr condition codes are unaffected by these instructions.
S3C2440a risc microprocessor thumb inst ruction set 4- 29 instruction cycle times all instructions in this format have an equivalent arm instruction as shown in table 4-13. the instruction cycle times for the thumb instruction are identical to that of the equivalent arm instruction. examples add r2, pc, #572 ; r2 := pc + 572, but don't set thecondition codes. bit[1] of pc is forced to zero.note that the thumb opcode willcontai n 143 as the word8 value. add r6, sp, #212 ; r6 := sp (r13) + 212, but don'tset the condition codes. note that the thumb opcode will contain 53 as the word 8 value.
thumb instruction set S3C2440a risc mi croprocessor 4- 30 format 13: add offset to stack pointer [6:0] 7-bit immediate value [7] sign flag 0 = offset is positive 1 = offset is negative 15 0 1 14 10 0 1 13 12 11 sword 7 1 0 0 7 8 9 6 0 0 s figure 4-14. format 13 operation this instruction adds a 9-bit signed constant to the stack pointer. the following table shows the thumb assembler syntax. table 4-14. the add sp instruction l thumb assembler arm equivalent description 0 add sp, #imm add r13, r13, #imm add #imm to the stack pointer (sp). 1 add sp, # -imm sub r13, r13, #imm add #-imm to the stack pointer (sp). note: the offset specified by #imm can be up to -/+ 508, but must be word-aligned (ie with bits 1:0 set to 0) since the assembler converts #imm to an 8-bit sign + magnitude number before placing it in field sword7. the condition codes are not set by this instruction. instruction cycle times all instructions in this format have an equivalent arm instruction as shown in table 4-14. the instruction cycle times for the thumb instruction are identical to that of the equivalent arm instruction. examples add sp, #268 ; sp (r13) := sp + 268, but don't set the condition codes. note that the thumb opcode will contain 67 as the word7 value and s=0. add sp, #-104 ; sp (r13) := sp - 104, but don't set the condition codes. ; note that the thumb opcode will contain 26 as the word7 value and s=1.
S3C2440a risc microprocessor thumb inst ruction set 4- 31 format 14: push/pop registers [7:0] register list [8] pc/lr bit 0 = do not store lr/load pc 1 = store lr/load pc [11] load/store bit 0 = store to memory 1 = load from memory 15 0 1 14 10 0 1 13 12 11 rlist 1 l 0 7 8 9 1 r figure 4-15. format 14 operation the instructions in this group allow registers 0-7 and optionally lr to be pushed onto the stack, and registers 0-7 and optionally pc to be popped off the stack. the thumb assembler syntax is shown in table 4-15. note the stack is always assumed to be full descending. table 4-15. push and pop instructions l b thumb assembler arm equivalent description 0 0 push { rlist } stmdb r13!, { rlist } push the registers specified by rlist onto the stack. update the stack pointer. 0 1 push { rlist, lr } stmdb r13!, { rlist, r14 } push the link register and the registers specified by rlist (if any) onto the stack. update the stack pointer. 1 0 pop { rlist } ldmia r13!, { rlist } pop values off the stack into the registers specified by rlist. update the stack pointer. 1 1 pop { rlist, pc } ldmia r13!, {rlist, r15} pop values off the stack and load into the registers specified by rlist. pop the pc off the stack. update the stack pointer.
thumb instruction set S3C2440a risc mi croprocessor 4- 32 instruction cycle times all instructions in this format have an equivalent arm instruction as shown in table 4-15. the instruction cycle times for the thumb instruction are identical to that of the equivalent arm instruction. examples push {r0-r4,lr} ; store r0,r1,r2,r3,r4 and r14 (lr) at the stack pointed to by r13 (sp) and update r13. useful at start of a sub-routine to save workspace and return address. pop {r2,r6,pc} ; load r2,r6 and r15 (pc) from the stack pointed to by r13 (sp) and upda te r13.useful to restore workspace and return from sub-routine.
S3C2440a risc microprocessor thumb inst ruction set 4- 33 format 15: multiple load/store [7:0] register list [10:8] base register [11] load/store bit 0 = store to memory 1 = load from memory 15 0 1 14 10 1 0 13 12 11 rlist 0 l 7 8 rb figure 4-16. format 15 operation these instructions allow multiple loading and storing of lo registers. the thumb assembler syntax is shown in the following table. table 4-16. the multiple load/store instructions l thumb assembler arm equivalent description 0 stmia rb!, { rlist } stmia rb!, { rlist } store the registers specified by rlist, starting at the base address in rb. write back the new base address. 1 ldmia rb!, { rlist } ldmia rb!, { rlist } load the registers specified by rlist, starting at the base address in rb. write back the new base address. instruction cycle times all instructions in this format have an equivalent arm instruction as shown in table 4-16. the instruction cycle times for the thumb instruction are identical to that of the equivalent arm instruction. examples stmia r0!, {r3-r7} ; store th e contents of registers r3-r7 starting at the address specified in r0, incrementing the addresses for each word. write back the updated value of r0.
thumb instruction set S3C2440a risc mi croprocessor 4- 34 format 16: conditional branch [7:0] 8-bit signed immediate [11:8] condition 15 0 1 14 1 0 13 12 11 soffset 8 1 7 8 cond figure 4-17. format 16 operation the instructions in this group all perform a conditional branch depending on the state of the cpsr condition codes. the branch offset must take account of the prefetch operation, which causes the pc to be 1 word (4 bytes) ahead of the current instruction. the thumb assembler syntax is shown in the following table. table 4-17. the conditional branch instructions l thumb assembler arm equivalent description 0000 beq label beq label branch if z set (equal) 0001 bne label bne label branch if z clear (not equal) 0010 bcs label bcs label branch if c set (unsigned higher or same) 0011 bcc label bcc label branch if c clear (unsigned lower) 0100 bmi label bmi label branch if n set (negative) 0101 bpl label bpl label branch if n clear (positive or zero) 0110 bvs label bvs label branch if v set (overflow) 0111 bvc label bvc label branch if v clear (no overflow) 1000 bhi label bhi label branch if c set and z clear (unsigned higher)
S3C2440a risc microprocessor thumb inst ruction set 4- 35 table 4-17. the conditional branch instructions (continued) l thumb assembler arm equivalent description 1001 bls label bls label branch if c clear or z set (unsigned lower or same) 1010 bge label bge label branch if n set and v set, or n clear and v clear (greater or equal) 1011 blt label blt label branch if n set and v clear, or n clear and v set (less than) 1100 bgt label bgt label branch if z clear, and either n set and v set or n clear and v clear (greater than) 1101 ble label ble label branch if z set, or n set and v clear, or n clear and v set (less than or equal) notes: 1. while label specifies a full 9-bit two's complement address, this must always be halfword-aligned (ie with bit 0 set to 0) since the assembler actually places label >> 1 in field soffset8. 2. cond = 1110 is undefined, and should not be used. cond = 1111 c reates the swi instruction: see. instruction cycle times all instructions in this format have an equivalent arm instruction as shown in table 3-1. the instruction cycle times for the thumb instruction are identical to that of the equivalent arm instruction. examples cmp r0, #45 ; branch to over-if r0 > 45. bgt over ; note that the thumb opcode will contain the number of halfwords to offset. over ; must be halfword aligned.
thumb instruction set S3C2440a risc mi croprocessor 4- 36 format 17: software interrupt [7:0] comment field 15 0 1 14 1 0 13 12 11 value 8 1 7 8 10 9 1 1 1 1 figure 4-18. format 17 operation the swi instruction performs a software interrupt. on taking the swi, the processor switches into arm state and enters supervisor (svc) mode. the thumb assembler syntax for this instruction is shown below. table 4-18. the swi instruction thumb assembler arm equivalent description swi value 8 swi value 8 perform software interrupt: move the address of the next instruction into lr, move cpsr to spsr, load the swi vector address (0x8) into the pc. switch to arm state and enter svc mode. note: value8 is used solely by the swi handler; it is ignored by the processor. instruction cycle times all instructions in this format have an equivalent arm instruction as shown in table 4-18. the instruction cycle times for the thumb instruction are identical to that of the equivalent arm instruction. examples swi 18 ; take the software interrupt exception. enter supervisor mode with 18 as the requested swi number.
S3C2440a risc microprocessor thumb inst ruction set 4- 37 format 18: unconditional branch [10:0] immediate value 15 0 1 14 1 1 13 12 11 offset11 0 10 0 figure 4-19. format 18 operation this instruction performs a pc-relative branch. the thumb assembler syntax is shown below. the branch offset must take account of the prefetch operation, which causes the pc to be 1 word (4 bytes) ahead of the current instruction. table 4-19. summary of branch instruction thumb assembler arm equivalent description b label bal label (halfword offset) branch pc relative offset11 << 1, where label is pc 2048 bytes. note: the address specified by label is a full 12-bit two's complement address, but must always be halfword aligned (ie bit 0 set to 0), since the assembler places label >> 1 in the offset11 field. examples here b here ; branch onto itself. assembles to 0xe7fe. (note effect of pc offset). b jimmy ; branch to 'jimmy'. note that the thumb opcode will contain the number of ; halfwords to offset. jimmy must be halfword aligned.
thumb instruction set S3C2440a risc mi croprocessor 4- 38 format 19: long branch with link [10:0] long branch and link offset high/low [11] low/high offset bit 0 = offset high 1 = offset low 15 0 1 14 1 1 13 12 11 offset 1 10 h figure 4-20. format 19 operation this format specifies a long branch with link. the assembler splits the 23-bit two's complement half-word offset specified by the label into two 11-bit halves, ignoring bit 0 (which must be 0), and creates two thumb instructions. instruction 1 (h = 0) in the first instruction the offset field contains the upper 11 bits of the target address. this is shifted left by 12 bits and added to the current pc address. the resulting address is placed in lr. instruction 2 (h =1) in the second instruction the offset field contains an 11-bit representation lower half of the target address. this is shifted left by 1 bit and added to lr. lr, which now contains the full 23-bit address, is placed in pc, the address of the instruction following the bl is placed in lr and bit 0 of lr is set. the branch offset must take account of the prefetch operation, which causes the pc to be 1 word (4 bytes) ahead of the current instruction
S3C2440a risc microprocessor thumb inst ruction set 4- 39 instruction cycle times this instruction format does not have an equivalent arm instruction. table 4-20. the bl instruction l thumb assembler arm equivalent description 0 bl label none lr := pc + offsethigh << 12 1 temp := next instruction address pc := lr + offsetlow << 1 lr := temp | 1 examples bl faraway ; unconditionally branch to 'faraway' next and place following instruction address, ie "next", in r14,the link register and set bit 0 of lr high. note that the thumb opcodes will contain the number of halfwords to offset. faraway ; must be half-word aligned.
thumb instruction set S3C2440a risc mi croprocessor 4- 40 instruction set examples the following examples show ways in which the thumb instructions may be used to generate small and efficient code. each example also shows the arm equivalent so these may be compared. multiplication by a constant using shifts and adds the following instructions are the code to multiply by various constants using 1, 2 or 3 thumb instructions alongside the arm equivalents. for other constants it is generally better to use the built-in mul instruction rather than using a sequence of 4 or more instructions. thumb arm 1. multiplication by 2^n (1,2,4,8,...) lsl ra, rb, lsl #n ; mov ra, rb, lsl #n 2. multiplication by 2^n+1 (3,5,9,17,...) lsl rt, rb, #n ; add ra, rb, rb, lsl #n add ra, rt, rb 3. multiplication by 2^n-1 (3,7,15,...) lsl rt, rb, #n ; rsb ra, rb, rb, lsl #n sub ra, rt, rb 4. multiplication by -2^n (-2, -4, -8, ...) lsl ra, rb, #n ; mov ra, rb, lsl #n mvn ra, ra ; rsb ra, ra, #0 5. multiplication by -2^n-1 (-3, -7, -15, ...) lsl rt, rb, #n ; sub ra, rb, rb, lsl #n sub ra, rb, rt multiplication by any c = {2^n+1, 2^n-1, -2^n or -2^n-1} * 2^n effectively this is any of the multiplications in 2 to 5 followed by a final shift. this allows the following additional constants to be multiplied. 6, 10, 12, 14, 18, 20, 24, 28, 30, 34, 36, 40, 48, 56, 60, 62 ..... (2..5) ; (2..5) lsl ra, ra, #n ; mov ra, ra, lsl #n
S3C2440a risc microprocessor thumb inst ruction set 4- 41 general purpose signed divide this example shows a general purpose signed divide and remainder routine in both thumb and arm code. thumb code ;signed_divide ; signed divide of r1 by r0: returns quotient in r0, ; remainder in r1 ;get abs value of r0 into r3 asr r2, r0, #31 ; get 0 or -1 in r2 depending on sign of r0 eor r0, r2 ; eor with -1 (0 ffffffff) if negative sub r3, r0, r2 ; and add 1 (sub -1) to get abs value ;sub always sets flag so go & report division by 0 if necessary beq divide_by_zero ;get abs value of r1 by xoring with 0xffffffff and adding 1 if negative asr r0, r1, #31 ; get 0 or -1 in r3 depending on sign of r1 eor r1, r0 ; eor with -1 (0 ffffffff) if negative sub r1, r0 ; and add 1 (sub -1) to get abs value ;save signs (0 or -1 in r0 & r2) for later use in determining ; sign of quotient & remainder. push {r0, r2} ;justification, shift 1 bit at a time until divisor (r0 value) ; is just <= than dividend (r1 value). to do this shift dividend ; right by 1 and stop as soon as shifted value becomes >. lsr r0, r1, #1 mov r2, r3 b %ft0 just_l lsl r2, #1 0 cmp r2, r0 bls just_l mov r0, #0 ; set accumulator to 0 b %ft0 ; branch into division loop div_l lsr r2, #1 0 cmp r1, r2 ; test subtract bcc %ft0 sub r1, r2 ; if successful do a real subtract 0 adc r0, r0 ; shift result and add 1 if subtract succeeded cmp r2, r3 ; terminate when r2 == r3 (ie we have just bne div_l ; tested subtracting the 'ones' value).
thumb instruction set S3C2440a risc mi croprocessor 4- 42 now fix up the signs of the quotient (r0) and remainder (r1) pop {r2, r3} ; get dividend/divisor signs back eor r3, r2 ; result sign eor r0, r3 ; negate if result sign = - 1 sub r0, r3 eor r1, r2 ; negate remainder if dividend si gn = - 1 sub r1, r2 mov pc, lr arm code signed_divide ; effectively zero a4 as top bit will be shifted out later ands a4, a1, #&80000000 rsbmi a1, a1, #0 eors ip, a4, a2, asr #32 ;ip bit 31 = sign of result ;ip bit 30 = sign of a2 rsbcs a2, a2, #0 ;central part is identical code to udiv (without mov a4, #0 which comes for free as part of signed entry sequence) movs a3, a1 beq divide_by_zero just_l ; justification stage shifts 1 bit at a time cmp a3, a2, lsr #1 movls a3, a3, lsl #1 ; nb: lsl #1 is always ok if ls succeeds blo s_loop div_l cmp a2, a3 adc a4, a4, a4 subcs a2, a2, a3 teq a3, a1 movne a3, a3, lsr #1 bne s_loop2 mov a1, a4 movs ip, ip, asl #1 rsbcs a1, a1, #0 rsbmi a2, a2, #0 ce mov pc, lr
S3C2440a risc microprocessor thumb inst ruction set 4- 43 division by a constant division by a constant can often be performed by a short fixed sequence of shifts, adds and subtracts. here is an example of a divide by 10 routine based on the algorithm in the arm cookbook in both thumb and arm code. thumb code udiv10 ; take argument in a1 returns quotient in a1, ; remainder in a2 mov a2, a1 lsr a3, a1, #2 sub a1, a3 lsr a3, a1, #4 add a1, a3 lsr a3, a1, #8 add a1, a3 lsr a3, a1, #16 add a1, a3 lsr a1, #3 asl a3, a1, #2 add a3, a1 asl a3, #1 sub a2, a3 cmp a2, #10 blt %ft0 add a1, #1 sub a2, #10 0 mov pc, lr arm code udiv10 ; take argument in a1 returns quo tient in a1, ; remainder in a2 sub a2, a1, #10 sub a1, a1, a1, lsr #2 add a1, a1, a1, lsr #4 add a1, a1, a1, lsr #8 add a1, a1, a1, lsr #16 mov a1, a1, lsr #3 add a3, a1, a1, asl #2 subs a2, a2, a3, asl #1 addpl a1, a1, #1 addmi a2, a2, #10 mov pc, lr
thumb instruction set S3C2440a risc mi croprocessor 4- 44 notes
S3C2440a risc microprocessor memory controller 5- 1 5 memory controller overview the S3C2440a memory controller provides memory control signals that are required for external memory access. the S3C2440a has the following features: ? little/big endian ( selectable by a software) ? address space: 128mbytes per bank (total 1gb/8 banks) ? programmable access size (8/16/32-bit) for all banks except bank0 (16/32-bit) ? total 8 memory banks six memory banks for rom, sram, etc. remaining two memory banks for rom, sram, sdram, etc . ? seven fixed memory bank start address ? one flexible memory bank start address and programmable bank size ? programmable access cycles for all memory banks ? external wait to extend the bus cycles ? supporting self-refresh and power down mode in sdram
memory controller s 3c2440a risc microprocessor 5- 2 0x0000_0000 0x0800_0000 0x1000_0000 0x1800_0000 0x2000_0000 0x2800_0000 0x3000_0000 0x3800_0000 0x4000_0000 srom/sdram (ngcs7) srom/sdram (ngcs6) srom (ngcs5) srom (ngcs4) srom (ngcs3) srom (ngcs2) srom (ngcs1) boot internal sram (4kb) 128 mb 128mb 128mb 128mb 128mb 128mb 2mb/4mb/8mb/16mb /32mb/64mb/128mb 2mb/4mb/8mb/16mb /32mb/64mb/128mb refer to table 5 1gb haddr[29:0] accessible region srom/sdram (ngcs7) srom/sdram (ngcs6) srom (ngcs5) srom (ngcs4) srom (ngcs3) srom (ngcs2) srom (ngcs1) srom (ngcs0) om[1:0] = 01,10 om[1:0] = 00 [ not using nand flash for boot rom ] [ using nand flash for boot rom ] boot internal sram (4kb) figure 5-1. S3C2440a memory map after reset note srom means rom or sram type memory
S3C2440a risc microprocessor memory controller 5- 3 table 5-1. bank 6/7 addresses address 2mb 4mb 8mb 16mb 32mb 64mb 128mb bank 6 start address 0x3000_0000 0x3000_0000 0x3000_0000 0x3000_0000 0x3000_0000 0x3000_0000 0x3000_0000 end address 0x301f_ffff 0x303f_ffff 0x307f_ffff 0x30ff_ffff 0x31ff_ffff 0x33ff_ffff 0x37ff_ffff bank 7 start address 0x3020_0000 0x3040_0000 0x3080_0000 0x3100_0000 0x3200_0000 0x3400_0000 0x3800_0000 end address 0x303f_ffff 0x307f_ffff 0x30ff_ffff 0x31ff_ffff 0x33ff_ffff 0x37ff_ffff 0x3fff_ffff note: bank 6 and 7 must have the same memory size.
memory controller s 3c2440a risc microprocessor 5- 4 function description bank0 bus width the data bus of bank0 (ngcs0) should be configured with a width as one of 16-bit and 32-bit ones. because the bank0 works as the booting rom bank (map to 0x0000_0000), the bus width of bank0 should be determined before the first rom access, which will depend on the logic level of om[1:0] at reset. om1 (operating mode 1) om0 (operating mode 0) booting rom data width 0 0 nand flash mode 0 1 16-bit 1 0 32-bit 1 1 test mode memory (srom/sdram) address pin connections memory addr. pin S3C2440a addr. @ 8-bit data bus S3C2440a addr. @ 16-bit data bus S3C2440a addr. @ 32-bit data bus a0 a0 a1 a2 a1 a1 a2 a3 . . . . . . . . . . . .
S3C2440a risc microprocessor memory controller 5- 5 sdram bank address pin connection example table 5-2. sdram bank address configuration example bank size bus width base component memory configuration bank address 2mbyte x8 16mbit (1m x 8 x 2bank) x 1 a20 x16 (512k x 16 x 2b) x 1 4mb x16 (1m x 8 x 2b) x 2 a21 x16 (1m x 8 x 2b) x 2 8mb x16 16mb (2m x 4 x 2b) x 4 a22 x32 (1m x 8x 2b) x 4 x8 64mb (4m x 8 x 2b) x 1 x8 (2m x 8 x 4b) x 1 a[22:21] x16 (2m x 16 x 2b) x 1 a22 x16 (1m x 16 x 4b) x 1 a[22:21] x32 (512k x 32 x 4b) x 1 16mb x32 16mb (2m x 4 x 2b) x 8 a23 x8 64mb (8m x 4 x 2b) x 2 x8 (4m x 4 x 4b) x 2 a[23:22] x16 (4m x 8 x 2b) x 2 a23 x16 (2m x 8 x 4b) x 2 a[23:22] x32 (2m x 16 x 2b) x 2 a23 x32 (1m x 16 x 4b) x 2 a[23:22] x8 128mb (4m x 8 x 4b) x 1 x16 (2m x 16 x 4b) x 1 32mb x16 64mb (8m x 4 x 2b) x 4 a24 x16 (4m x 4 x 4b) x 4 a[24:23] x32 (4m x 8 x 2b) x 4 a24 x32 (2m x 8 x 4b) x 4 a[24:23] x16 128mb (4m x 8 x 4b) x 2 x32 (2m x 16 x 4b) x 2 x8 256mb (8m x 8 x 4b) x 1 x16 (4m x 16 x 4b) x 1 64mb x32 128mb (4m x 8 x 4b) x 4 a[25:24] x16 256mb (8m x 8 x 4b) x 2 x32 (4m x 16 x 4b) x 2 x8 512mb (16m x 8 x 4b) x 1 128mb x32 256mb (8m x 8 x 4bank) x 4 a[26:25] x8 512mb (32m x 4 x 4b) x 2 x16 (16m x 8 x 4b) x 2 x32 (8m x 16 x 4b) x 2
memory controller s 3c2440a risc microprocessor 5- 6 n wait pin operation if the wait bit(wsn bit in bwscon) corresponding to each memory bank is enabled, the noe duration should be prolonged by the external nwait pin while the memory bank is active. nwait is checked from tacc-1. noe will be de-asserted at the next clock after sampling nwait is high. the nwe signal have the same relation with noe. tacs tcos tacc=4 hclk addr ngcs noe nwait data(r) delayed sampling nwait figure 5-2. S3C2440a external nwait timing diagram (tacc=4)
S3C2440a risc microprocessor memory controller 5- 7 nxbreq/nxback pin operation if nxbreq is asserted, the S3C2440a will respond by lowering nxback. if nxback=l, the address/data bus and memory control signals are in hi-z state as shown in table 1-1. after nxbreq is de-asserted, the nxback will also be de-asserted. hclk scke, a[24:0] d[31:0], ngcs noe,nwe nwbe nxbreq nxback sclk 1clk figure 5-3. S3C2440a nxbreq/ nxback timing diagram
memory controller s 3c2440a risc microprocessor 5- 8 rom memory interface examples a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 d0 d1 d2 d3 d4 d5 d6 d7 nwe noe ngcsn a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 dq0 dq1 dq2 dq3 dq4 dq5 dq6 dq7 nwe noe nce figure 5-4. memory interface with 8-bit rom a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 d0 d1 d2 d3 d4 d5 d6 d7 nwbe0 noe ngcsn a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 dq0 dq1 dq2 dq3 dq4 dq5 dq6 dq7 nwe noe nce a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 d8 d9 d10 d11 d12 d13 d14 d15 nwbe1 noe ngcsn a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 dq0 dq1 dq2 dq3 dq4 dq5 dq6 dq7 nwe noe nce figure 5-5. memory interface with 8-bit rom x 2
S3C2440a risc microprocessor memory controller 5- 9 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 dq0 dq1 dq2 dq3 dq4 dq5 dq6 dq7 nwe noe nce d0 d1 d2 d3 d4 d5 d6 d7 nwbe0 noe ngcsn a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 dq0 dq1 dq2 dq3 dq4 dq5 dq6 dq7 nwe noe nce d8 d9 d10 d11 d12 d13 d14 d15 nwbe1 noe ngcsn a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 dq0 dq1 dq2 dq3 dq4 dq5 dq6 dq7 nwe noe nce d16 d17 d18 d19 d20 d21 d22 d23 nwbe2 noe ngcsn a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 dq0 dq1 dq2 dq3 dq4 dq5 dq6 dq7 nwe noe nce d24 d25 d26 d27 d28 d29 d30 d31 nwbe3 noe ngcsn figure 5-6. memory interface with 8-bit rom x 4 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 d10 d11 d12 d13 d14 d15 a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 dq0 dq1 dq2 dq3 dq4 dq5 dq6 dq7 dq8 dq9 dq10 dq11 dq12 dq13 dq14 dq15 nwe noe nce nwe noe ngcsn figure 5-7. memory interface with 16-bit rom
memory controller s 3c2440a risc microprocessor 5- 10 sram memory interface examples a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 d10 d11 d12 d13 d14 d15 a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 dq0 dq1 dq2 dq3 dq4 dq5 dq6 dq7 dq8 dq9 dq10 dq11 dq12 dq13 dq14 dq15 nwe noe ncs nwe noe ngcsn nub nlb nbe1 nbe0 figure 5-8. memory interface with 16-bit sram a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 d10 d11 d12 d13 d14 d15 a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 dq0 dq1 dq2 dq3 dq4 dq5 dq6 dq7 dq8 dq9 dq10 dq11 dq12 dq13 dq14 dq15 nwe noe ncs nwe noe ngcsn nub nlb nbe1 nbe0 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 d16 d17 d18 d19 d20 d21 d22 d13 d24 d25 d26 d27 d28 d29 d30 d31 a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 dq0 dq1 dq2 dq3 dq4 dq5 dq6 dq7 dq8 dq9 dq10 dq11 dq12 dq13 dq14 dq15 nwe noe ncs nwe noe ngcsn nub nlb nbe3 nbe2 figure 5-9. memory interface with 16-bit sram x 2
S3C2440a risc microprocessor memory controller 5- 11 sdram memory interface examples a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 d10 d11 d12 d13 d14 d15 a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 dq0 dq1 dq2 dq3 dq4 dq5 dq6 dq7 dq8 dq9 dq10 dq11 dq12 dq13 dq14 dq15 ba0 ba1 ldqm udqm a21 a22 dqm0 dqm1 scke sclk scke sclk nscs0 nsras nscas nwe nscs nsras nscas nwe figure 5-10. memory interface with 16-bit sdram (4mx16, 4banks) a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 d10 d11 d12 d13 d14 d15 a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 dq0 dq1 dq2 dq3 dq4 dq5 dq6 dq7 dq8 dq9 dq10 dq11 dq12 dq13 dq14 dq15 ba0 ba1 ldqm udqm a24 a25 dqm0 dqm1 scke sclk scke sclk nscs0 nsras nscas nwe nscs nsras nscas nwe a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 dq0 dq1 dq2 dq3 dq4 dq5 dq6 dq7 dq8 dq9 dq10 dq11 dq12 dq13 dq14 dq15 ba0 ba1 ldqm udqm a24 a25 dqm2 dqm3 scke sclk scke sclk nscs0 nsras nscas nwe nscs nsras nscas nwe d16 d17 d18 d19 d20 d21 d22 d23 d24 d25 d26 d27 d28 d29 d30 d31 figure 5-11. memory interface with 16-bit sdram (4mx16x4bank * 2ea) note refer to table 5-2 for the bank address configurations of sdram.
memory controller s 3c2440a risc microprocessor 5- 12 programmable access cycle tcoh tcos tacs hclk a[24:0] ngcs noe nwe nwbe d[31:0](r) d[31:0] (w) tacc tacp tcah tacs = 1 cycle tcos = 1 cycle tacc = 3 cycles tacp = 2 cycles tcoh = 1 cycle tcah = 2 cycles figure 5-12. S3C2440a ngcs timing diagram
S3C2440a risc microprocessor memory controller 5- 13 mclk scke nscs nscas addr a10/ap ra nsras ba data (cl2) data (cl3) nwe dqm trp trcd ra ca da da ba ba cb cc cd ce db dc dd de db dc dd de ba ba ba ba ba bank precharge row active write read (cl = 2, cl = 3, bl = 1) trp = 2 cycle tcas = 2 cycle trcd = 2 cycle tcp = 2 cycle figure 5-13. S3C2440a sdram timing diagram
memory controller s 3c2440a risc microprocessor 5- 14 bus width & wait control register (bwscon) register address r/w description reset value bwscon 0x48000000 r/w bus width & wait status control register 0x000000 bwscon bit description initial state st7 [31] determines sram for using ub/lb for bank 7. 0 = not using ub/lb (the pins are dedicated nwbe[3:0]) 1 = using ub/lb (the pins are dedicated nbe[3:0]) 0 ws7 [30] determines wait status for bank 7. 0 = wait disable 1 = wait enable 0 dw7 [29:28] determines data bus width for bank 7. 00 = 8-bit 01 = 16-bit, 10 = 32-bit 11 = reserved 0 st6 [27] determines sram for using ub/lb for bank 6. 0 = not using ub/lb (the pins are dedicated nwbe[3:0 ) 1 = using ub/lb (the pins are dedicated nbe[3:0]) 0 ws6 [26] determines wait status for bank 6. 0 = wait disable, 1 = wait enable 0 dw6 [25:24] determines data bus width for bank 6. 00 = 8-bit 01 = 16-bit, 10 = 32-bit 11 = reserved 0 st5 [23] determines sram for using ub/lb for bank 5. 0 = not using ub/lb (the pins are dedicated nwbe[3:0]) 1 = using ub/lb (the pins are dedicated nbe[3:0]) 0 ws5 [22] determines wait status for bank 5. 0 = wait disable, 1 = wait enable 0 dw5 [21:20] determines data bus width for bank 5. 00 = 8-bit 01 = 16-bit, 10 = 32-bit 11 = reserved 0 st4 [19] determines sram for using ub/lb for bank 4. 0 = not using ub/lb (the pins are dedicated nwbe[3:0]) 1 = using ub/lb (the pins are dedicated nbe[3:0]) 0 ws4 [18] determines wait status for bank 4. 0 = wait disable 1 = wait enable 0 dw4 [17:16] determine data bus width for bank 4. 00 = 8-bit 01 = 16-bit, 10 = 32-bit 11 = reserved 0 st3 [15] determines sram for using ub/lb for bank 3. 0 = not using ub/lb (the pins are dedicated nwbe[3:0]) 1 = using ub/lb (the pins are dedicated nbe[3:0]) 0 ws3 [14] determines wait status for bank 3. 0 = wait disable 1 = wait enable 0 dw3 [13:12] determines data bus width for bank 3. 00 = 8-bit 01 = 16-bit, 10 = 32-bit 11 = reserved 0 st2 [11] determines sram for using ub/lb for bank 2. 0 = not using ub/lb (the pins are dedicated nwbe[3:0]) 1 = using ub/lb (the pins are dedicated nbe[3:0].) 0
S3C2440a risc microprocessor memory controller 5- 15 bus width & wait control register (bwscon) ( continued) bwscon bit description initial state ws2 [10] determines wait status for bank 2. 0 = wait disable 1 = wait enable 0 dw2 [9:8] determines data bus width for bank 2. 00 = 8-bit 01 = 16-bit, 10 = 32-bit 11 = reserved 0 st1 [7] determines sram for using ub/lb for bank 1. 0 = not using ub/lb (the pins are dedicated nwbe[3:0]) 1 = using ub/lb (the pins are dedicated nbe[3:0]) 0 ws1 [6] determines wait status for bank 1. 0 = wait disable, 1 = wait enable 0 dw1 [5:4] determines data bus width for bank 1. 00 = 8-bit 01 = 16-bit, 10 = 32-bit 11 = reserved 0 dw0 [2:1] indicate data bus width for bank 0 (read only). 01 = 16-bit, 10 = 32-bit the states are selected by om[1:0] pins ? reserved [0] reserve to 0 0 notes: 1. all types of master clock in this memory controller correspond to the bus clock. for example, hclk in sram is the same as the bus clock, and sclk in sdram is also the same as the bus clock. in this chapter (memory controller), one clock means one bus clock. 2. nbe [3:0] is the 'and' signal nwbe[3:0] and noe.
memory controller s 3c2440a risc microprocessor 5- 16 bank control register (bankconn: ngcs0-ngcs5) register address r/w description reset value bankcon0 0x48000004 r/w bank 0 control register 0x0700 bankcon1 0x48000008 r/w bank 1 control register 0x0700 bankcon2 0x4800000c r/w bank 2 control register 0x0700 bankcon3 0x48000010 r/w bank 3 control register 0x0700 bankcon4 0x48000014 r/w bank 4 control register 0x0700 bankcon5 0x48000018 r/w bank 5 control register 0x0700 bankconn bit description initial state tacs [14:13] address set-up time before ngcsn 00 = 0 clock 01 = 1 clock 10 = 2 clocks 11 = 4 clocks 00 tcos [12:11] chip selection set-up time before noe 00 = 0 clock 01 = 1 clock 10 = 2 clocks 11 = 4 clocks 00 tacc [10:8] access cycle 000 = 1 clock 001 = 2 clocks 010 = 3 clocks 011 = 4 clocks 100 = 6 clocks 101 = 8 clocks 110 = 10 clocks 111 = 14 clocks note: when nwait signal is used, tacc 3 4 clocks. 111 tcoh [7:6] chip selection hold time after noe 00 = 0 clock 01 = 1 clock 10 = 2 clocks 11 = 4 clocks 000 tcah [5:4] address hold time after ngcsn 00 = 0 clock 01 = 1 clock 10 = 2 clocks 11 = 4 clocks 00 tacp [3:2] page mode access cycle @ page mode 00 = 2 clocks 01 = 3 clocks 10 = 4 clocks 11 = 6 clocks 00 pmc [1:0] page mode configuration 00 = normal (1 data) 01 = 4 data 10 = 8 data 11 = 16 data 00
S3C2440a risc microprocessor memory controller 5- 17 bank control register (bankcon n : n gcs6- n gcs7) register address r/w description reset value bankcon6 0x4800001c r/w bank 6 control register 0x18008 bankcon7 0x48000020 r/w bank 7 control register 0x18008 bankconn bit description initial state mt [16:15] determine the memory type for bank6 and bank7. 00 = rom or sram 01 = reserved (do not use) 10 = reserved (do not use) 11 = sync. dram 11 memory type = rom or sram [mt=00] (15-bit) tacs [14:13] address set-up time before ngcs 00 = 0 clock 01 = 1 clock 10 = 2 clocks 11 = 4 clocks 00 tcos [12:11] chip selection set-up time before noe 00 = 0 clock 01 = 1 clock 10 = 2 clocks 11 = 4 clocks 00 tacc [10:8] access cycle 000 = 1 clock 001 = 2 clocks 010 = 3 clocks 011 = 4 clocks 100 = 6 clocks 101 = 8 clocks 110 = 10 clocks 111 = 14 clocks 111 tcoh [7:6] chip selection hold time after noe 00 = 0 clock 01 = 1 clock 10 = 2 clocks 11 = 4 clocks 00 tcah [5:4] address hold time after ngcsn 00 = 0 clock 01 = 1clock 10 = 2 clocks 11 = 4 clocks 00 tacp [3:2] page mode access cycle @ page mode 00 = 2 clocks 01 = 3 clocks 10 = 4 clocks 11 = 6 clocks 00 pmc [1:0] page mode configuration 00 = normal (1 data) 01 = 4 consecutive accesses 10 = 8 consecutive accesses 11 = 16 consecutive accesses 00 memory type = sdram [mt=11] (4-bit) trcd [3:2] ras to cas delay 00 = 2 clocks 01 = 3 clocks 10 = 4 clocks 10 scan [1:0] column address number 00 = 8-bit 01 = 9-bit 10= 10-bit 00
memory controller s 3c2440a risc microprocessor 5- 18 refresh control register register address r/w description reset value refresh 0x48000024 r/w sdram refresh control register 0xac0000 refresh bit description initial state refen [23] sdram refresh enable 0 = disable 1 = enable (self or cbr/auto refresh) 1 trefmd [22] sdram refresh mode 0 = cbr/auto refresh 1 = self refresh in self-refresh time, the sdram control signals are driven to the appropriate level. 0 trp [21:20] sdram ras pre-charge time 00 = 2 clocks 01 = 3 clocks 10 = 4 clocks 11 = not support 10 tsrc [19:18] sdram semi row cycle time 00 = 4 clocks 01 = 5 clocks 10 = 6 clocks 11 = 7 clocks sdram row cycle time: trc=tsrc+trp if trp = 3clocks & tsrc = 7clocks, trc = 3+7=10clocks. 11 reserved [17:16] not used 00 reserved [15:11] not used 0000 refresh counter [10:0] sdram refresh count value. refer to chapter 6 sdram refresh controller bus priority section. refresh period = (2 11 -refresh_count+1)/hclk ex) if refresh period is 7.8 us and hclk is 100mhz, the refresh count is as follows: refresh count = 2 11 + 1 - 100x7.8 = 1269 0
S3C2440a risc microprocessor memory controller 5- 19 banksize register register address r/w description reset value banksize 0x48000028 r/w flexible bank size register 0x0 banksize bit description initial state burst_en [7] arm core burst operation enable. 0 = disable burst operation. 1 = enable burst operation. 0 reserved [6] not used 0 scke_en [5] sdram power down mode enable control by scke 0 = sdram power down mode disable 1 = sdram power down mode enable 0 sclk_en [4] sclk is enabled only during sdram access cycle for reducing power consumption. when sdram is not accessed, sclk becomes 'l' level. 0 = sclk is always active. 1 = sclk is active only during the access (recommended). 0 reserved [3] not used 0 bk76map [2:0] bank6/7 memory map 010 = 128mb/128mb 001 = 64mb/64mb 000 = 32m/32m 111 = 16m/16m 110 = 8m/8m 101 = 4m/4m 100 = 2m/2m 010
memory controller s 3c2440a risc microprocessor 5- 20 sdram mode register set register (mrsr) register address r/w description reset value mrsrb6 0x4800002c r/w mode register set register bank6 xxx mrsrb7 0x48000030 r/w mode register set register bank7 xxx mrsr bit description initial state reserved [11:10] not used ? wbl [9] write burst length 0: burst (fixed) 1: reserved x tm [8:7] test mode 00: mode register set (fixed) 01, 10 and 11: reserved xx cl [6:4] cas latency 000 = 1 clock, 010 = 2 clocks, 011=3 clocks others: reserved xxx bt [3] burst type 0: sequential (fixed) 1: reserved x bl [2:0] burst length 000: 1 (fixed) others: reserved xxx note: mrsr register must not be reconfigured while the code is running on sdram. important note : in sleep mode, sdram has to enter sdram self-refresh mode.
S3C2440a risc microprocessor nand flash controller 6- 1 6 nand flash contorller overview in recent times, nor flash memory gets high in price while an sdram and a nand flash memory is comparatively economical , motivating some users to execute the boot code on a nand flash and execute the main code on an sdram. S3C2440a boot code can be executed on an external nand flash memory. in order to support nand flash boot loader, the S3C2440a is equipped with an internal sram buffer called ?steppingstone?. when booting, the first 4 kbytes of the nand flash memory will be loaded into steppingstone and the boot code loaded into steppingstone will be executed. generally, the boot code will copy nand flash content to sdram. using hardware ecc, the nand flash data validity will be checked . upon the completion of the copy, the main program will be executed on the sdram. features 1. auto boot: the boot code is transferred into 4-kbytes steppingstone during reset. after the transfer, the boot code will be executed on the steppingstone. 2. nand flash memory i/f: support 256words, 512bytes, 1kwords and 2kbytes page. 3. software mode: user can directly access nand flash memory, for example this feature can be used in read/erase/program nand flash memory . 4. interface: 8 / 16-bit nand flash memory interface bus. 5. hardware ecc gener ation, detection and indication (software correction). 6. sfr i/f: support little endian mode, byte/half word/word access to data and ecc data register, and word access to other registers 7. steppingstone i/f: support little/big endian, byte/half word/word access. 8. the steppingstone 4-kb internal sram buffer can be used for another purpose after nand flash booting.
nand flash controller S3C2440a risc microprocessor 6- 2 block diagram sfr ecc gen. stepping stone (4kb sram) stepping stone controller s y s t e m b u s nand flash interface cle ale nfce nfre nfwe frnb i/o0 - i/o15 ahb slave i/f control & state machine figure 6-1. nand flash controller block diagram boot loader function stepping stone (4kb buffer) nand flash controller nand flash memory special function registers registers auto boot core access (boot code) user access figure 6-2. nand flash controller boot loader block diagra m during reset, nand flash controller will get information about the connected nand flash through pin status (ncon(adv flash), gpg13(page size), gpg14(address cycle), gpg15(bus width) ? refer to pin configuration ), after power-on or system reset is occurred, the nand flash controller load automatically the 4- kbytes boot loader codes. after loading the boot loader codes, the boot loader code in steppingstone is executed. note during the auto boot, the ecc is not checked. so, the first 4-kb of nand flash should have no bit error.
S3C2440a risc microprocessor nand flash controller 6- 3 pin configuration om[1:0] = 00: enable nand flash memory boot ncon: nand flash memory selection(normal / advance) 0: normal nand flash(256words/512bytes page size, 3/4 address cycle) 1: advance nand flash(1kwords/2kbytes page size, 4/5 address cycle) gpg13: nand flash memory page capacitance selection 0: page=256words(ncon = 0) or page=1kwords(ncon = 1) 1: page=512bytes(ncon = 0) or page=2kbytes(ncon = 1) gpg14: nand flash memory address cycle selection 0: 3 address cycle(ncon = 0) or 4 address cycle(ncon = 1) 1: 4 address cycle(ncon = 0) or 5 address cycle(ncon = 1) gpg15: nand flash memory bus width selection 0: 8-bit bus width 1: 16-bit bus width note the configuration pin ? ncon, gpg[15:13] ? will be fetched during reset. in normal status, these pins must be set as input so that the pin status is not to be changed, when enters sleep mode by software or unexpected cause. nand flash memory configuration table ncon0 gpg13 gpg14 gpg15 0: normal nand 0: 256words 0: 3-addr 0: 8-bit bus width 1: 512bytes 1: 4-addr 1: advance nand 0: 1kwords 0: 4-addr 1: 16-bit bus width 1: 2kbytes 1: 5-addr note: with above 4-bit, possible total combinations are 16, but not all the value can be used. example) nand flash configuration setting. parts page size/total size ncon0 gpg13 gpg14] gpg15 k9s1208v0m-xxxx 512byte / 512mbit 0 1 1 0 k9k2g16u0m-xxxx 1kw / 2gbit 1 0 1 1
nand flash controller S3C2440a risc microprocessor 6- 4 nand flash memory timing hclk cle / ale nwe tacls twrph0 twrph1 data command / address figure 6-3. cle & ale timing (tacls=1, twrph0=0, twrph1=0) hclk nwe / nre data data twrph0 twrph1 figure 6-4. nwe & nre timing (twrph0=0, twrph1=0)
S3C2440a risc microprocessor nand flash controller 6- 5 software mode S3C2440a supports only software mode access. using this mode, you can completely access the nand flash memory. the nand flash controller supports direct access interface with the nand flash memory. 1. writing to the command register = the nand flash memory command cycle 2. writing to the address register = the nand flash memory address cycle 3. writ ing to the data register = write data to the nand flash memory (write cycle) 4. reading from the data register = read data from the nand flash memory (read cycle) 5. reading main ecc registers and spare ecc registers = read data from the nand flash memory note in the software mode, you have to check the rnb status input pin by using polling or interrupt.
nand flash controller S3C2440a risc microprocessor 6- 6 data register configuration 1. 16-bit nand flash memory interface a. word access register endian bit [31:24] bit [23:16] bit [15:8] bit [7:0] nfdata little 2 nd i/o[15:8] 2 nd i/o[ 7:0] 1 st i/o[15:8] 1 st i/o[ 7:0] nfdata big 1 st i/o[15:8] 1 st i/o[ 7:0] 2 nd i/o[15:8] 2 nd i/o[ 7:0] a. half-word access register endian bit [31:24] bit [23:16] bit [15:8] bit [7:0] nfdata little/big invalid value invalid value 1 st i/o[15:8] 1 st i/o[ 7:0] 1. 8-bit nand flash memory interface a. word access register endian bit [31:24] bit [23:16] bit [15:8] bit [7:0] nfdata little 4 th i/o[ 7:0] 3 rd i/o[ 7:0] 2 nd i/o[ 7:0] 1 st i/o[ 7:0] nfdata big 1 st i/o[ 7:0] 2 nd i/o[ 7:0] 3 nd i/o[ 7:0] 4 th i/o[ 7:0] a. half-word access register endian bit [31:24] bit [23:16] bit [15:8] bit [7:0] nfdata little invalid value invalid value 2 nd i/o[ 7:0] 1 st i/o[ 7:0] nfdata big invalid value invalid value 1 st i/o[ 7:0] 2 nd i/o[ 7:0] a. byte access register endian bit [31:24] bit [23:16] bit [15:8] bit [7:0] nfdata little/big invalid value invalid value invalid value 1 st i/o[ 7:0] steppingstone (4k-byte sram) the nand flash controller uses steppingstone as the buffer on booting and also you can use this area for another purpose.
S3C2440a risc microprocessor nand flash controller 6- 7 ecc (error correction code) nand flash controller consists of four ecc (error correction code) modules. the two ecc modules (one for data[7:0] and the other for data[15:8]) can be used for (up to) 2048 bytes ecc parity code generation, and the others(one for data[7:0] and the other for data[15:8]) can be used for (up to) 16 bytes ecc parity code generation. ? 28-bit ecc parity code = 22-bit line parity + 6bit column parity ? 14-bit ecc parity code = 8-bit line parity + 6bit column parity 2048 byte ecc parity code assignment table data7 data6 data5 data4 data3 data2 data1 data0 meccn_0 p64 p64? p32 p32? p16 p16? p8 p8? meccn_1 p1024 p1024? p512 p512? p256 p256? p128 p128? meccn_2 p4 p4? p2 p2? p1 p1? p2048 p2048? meccn_3 p8192 p8192? p4096 p4096? ? ? ? ? 16 byte ecc parity code assignment table data7 data6 data5 data4 data3 data2 data1 data0 seccn_0 p16 p16? p8 p8? p4 p4? p2 p2? seccn_1 p1 p1? p64 p64? p32 p32? ? ?
nand flash controller S3C2440a risc microprocessor 6- 8 ecc module features ecc generation is controlled by the ecc lock (mainecclock, spareecclock) bit of the control register. ecc register configuration (little / big endian) 1. 16-bit nand flash memory interface register bit [31:24] bit [23:16] bit [15:8] bit [7:0] nfmeccd0 2 nd ecc for i/o[15:8] 2 nd ecc for i/o[7:0] 1 st ecc for i/o[15:8] 1 st ecc for i/o[7:0] nfmeccd1 4 th ecc for i/o[15:8] 4 th ecc for i/o[7:0] 3 nd ecc for i/o[15:8] 3 nd ecc for i/o[7:0] register bit [31:24] bit [23:16] bit [15:8] bit [7:0] nfseccd 2 nd ecc for i/o[15:8] 2 nd ecc for i/o[7:0] 1 st ecc for i/o[15:8] 1 st ecc for i/o[7:0] 1. 8-bit nand flash memory interface register bit [31:24] bit [23:16] bit [15:8] bit [7:0] nfmeccd0 ? 2 nd ecc for i/o[7:0] ? 1 st ecc for i/o[7:0] nfmeccd1 ? 4 th ecc for i/o[7:0] ? 3 nd ecc for i/o[7:0] register bit [31:24] bit [23:16] bit [15:8] bit [7:0] nfseccd ? 2 nd ecc for i/o[7:0] ? 1 st ecc for i/o[7:0] ecc programming guide 1. in software mode, ecc module generates ecc parity code for all read / write data. so you have to r eset ecc value by writing the initecc(nfcont[4]) bit as ?1? and have to clear themainecclock(nfcont[5]) bit to ?0?(unlock) before read or write data. mainecclock(nfcont[5]) and spareecclock(nfcont[6]) control whether ecc parity code is generated or not. 2. whenever data is read or written, the ecc module generates ecc parity code on register nfmecc0/1. 3. after you completely read or write one page (not include spare area data), set the mainecclock bit to ?1?(lock). ecc parity code is locked and the value of the ecc status register will not be changed. 4. to generate spare area ecc parity code, clear as ?0?(unlock) spareecclock(nfcont[6]) bit. 5. whenever data is read or written, the spare area ecc module generates ecc parity code on register nfsecc. 6. after you completely read or write spare area, set the spareecclock bit to ?1?(lock). ecc parity code is locked and the value of the ecc status register will not be changed. 7. once completed you can use these values to record to the spare area or check the bit error. note nfseccd is for ecc in the spare area (usually, the user will write the ecc value of main data area to spare area, which value will be the same as nfmecc0/1) and which is generated from the main data area.
S3C2440a risc microprocessor nand flash controller 6- 9 nand flash memory mapping not used sfr area not used bootsram (4kb) 0xffff_ffff 0x6000_0000 0x4800_0000 0x4000_0000 sfr area not used sdram (bank7, ngcs7) 0x3800_0000 sdram (bank7, ngcs7) sdram (bank6, ngcs6) 0x3000_0000 sdram (bank6, ngcs6) srom (bank5, ngcs5) srom (bank5, ngcs5) 0x2000_0000 0x2800_0000 srom (bank4, ngcs4) srom (bank3, ngcs3) srom (bank2, ngcs2) 0x1000_0000 0x1800_0000 0x0800_0000 srom (bank1, ngcs1) srom (bank4, ngcs4) srom (bank3, ngcs3) srom (bank2, ngcs2) srom (bank1, ngcs1) srom (bank0, ngcs0) bootsram (4kb) 0x0000_0000 om[1:0] = 01, 10 om[1:0] = 00 0x4000_0fff figure 6-5. nand flash memory mapping note srom means rom or sram type memory
nand flash controller S3C2440a risc microprocessor 6- 10 nand flash memory configuration i/o7 i/o6 i/o5 i/o4 i/o3 i/o2 i/o1 i/o0 r/ b we ale cle ce re rnb nfwe ale cle nfce nfre data[7] data[6] data[5] data[4] data[3] data[2] data[1] data[0] figure 6-6. a 8-bit nand flash memory interface when you write the address, the same address is issued from data[7:0] and data[15:8] i/o7 i/o6 i/o5 i/o4 i/o3 i/o2 i/o1 i/o0 r/ b we ale cle ce re rn b nfwe ale cle nfce nfre data[7] data[6] data[5] data[4] data[3] data[2] data[1] data[0] i/o7 i/o6 i/o5 i/o4 i/o3 i/o2 i/o1 i/o0 r/ b we ale cle ce re rn b nfwe ale cle nfce nfre data[15] data[14] data[13] data[12] data[11] data[10] data[9] data[8] figure 6-7. two 8-bit nand flash memory interface
S3C2440a risc microprocessor nand flash controller 6- 11 i/o15 i/o14 i/o13 i/o12 i/o11 i/o10 i/o9 i/o8 r/ b we ale cle ce re i/o7 i/o6 i/o5 i/o4 i/o3 i/o2 i/o1 i/o0 rn b nfwe ale cle nfce nfre data[7] data[6] data[5] data[4] data[3] data[2] data[1] data[0] data[15] data[14] data[13] data[12] data[11] data[10] data[9] data[8] figure 6-8. a 16-bit nand flash memory interface
nand flash controller S3C2440a risc microprocessor 6- 12 nand flash configuration register register address r/w description reset value nfconf 0x4e000000 r/w nand flash configuration register 0x0000100x nfconf bit description initial state reserved [15:14] reserved ? tacls [13:12] cle & ale duration setting value (0~3) duration = hclk x tacls 01 reserved [11] reserved 0 twrph0 [10:8] twrph0 duration setting value (0~7) duration = hclk x ( twrph0 + 1 ) 000 reserved [7] reserved 0 twrph1 [6:4] twrph1 duration setting value (0~7) duration = hclk x ( twrph1 + 1 ) 000 advflash (read only) [3] advance nand flash memory for auto-booting 0: support 256 or 512 byte/page nand flash memory 1: support 1024 or 2048 byte/page nand flash memory this bit is determined by ncon0 pin status during reset and wake-up from sleep mode. h/w set (ncon0) pagesize (read only) [2] nand flash memory page size for auto-booting advflash pagesize when advflash is 0, 0: 256 word/page, 1: 512 bytes/page when advflash is 1, 0: 1024 word/page, 1: 2048 bytes/page this bit is determined by gpg13 pin status during reset and wake-up from sleep mode. after reset, the gpg13 can be used as general i/o port or external interrupt. h/w set (gpg13) addrcycle (read only) [1] nand flash memory address cycle for auto-booting advflash addrcycle when advflash is 0, 0: 3 address cycle 1: 4 address cycle when advflash is 1, 0: 4 address cycle 1: 5 address cycle this bit is determined by gpg14pin status during reset and wake-up from sleep mode. after reset, the gpg14can be used as general i/o port or external interrupt. h/w set (gpg14) buswidth (r/w) [0] nand flash memory i/o bus width for auto-booting and general access. 0: 8-bit bus 1: 16-bit bus this bit is determined by gpg15 pin status during reset and wake-up from sleep mode. after reset, the gpg15 can be used as general i/o port or external interrupt. this bit can be changed by software. h/w set (gpg15)
S3C2440a risc microprocessor nand flash controller 6- 13 control register register address r/w description reset value nfcont 0x4e000004 r/w nand flash control register 0x0384 nfcont bit description initial state reserved [14:15] reserved 0 lock-tight [13] lock-tight configuration 0: disable lock-tight 1: enable lock-tight, once this bit is set to 1, you cannot clear. only reset or wake up from sleep mode can make this bit disable(can not cleared by software). when it is set to 1, the area setting in nfsblk(0x4e000038) to nfeblk(0x4e00003c)-1 is unlocked, and except this area, write or erase command will be invalid and only read command is valid. when you try to write or erase locked area, the illegal access will be occur (nfstat[3] bit will be set). if the nfsblk and nfeblk are same, entire area will be locked. 0 soft lock [12] soft lock configuration 0: disable lock 1: enable lock soft lock area can be modified at any time by software. when it is set to 1, the area setting in nfsblk(0x4e000038) to nfeblk(0x4e00003c)-1 is unlocked, and except this area, write or erase command will be invalid and only read command is valid. when you try to write or erase locked area, the illegal access will be occur (nfstat[3] bit will be set). if the nfsblk and nfeblk are same, entire area will be locked. 1 reserved [11] reserved 0 enbillegalaccint [10] illegal access interrupt control 0: disable interrupt 1: enable interrupt illegal access interrupt is occurred when cpu tries to program or erase locking area (the area setting in nfsblk(0x4e000038) to nfeblk(0x4e00003c)-1). 0 enbrnbint [9] rnb status input signal transition interrupt control 0: disable rnb interrupt 1: enable rnb interrupt 0 rnb_transmode [8] rnb transition detection configuration 0: detect rising edge 1: detect falling edge 0 reserved [7] reserved 0
nand flash controller S3C2440a risc microprocessor 6- 14 control register ( continued) nfcont bit description initial state spareecclock [6] lock spare area ecc generation. 0: unlock spare ecc 1: lock spare ecc spare area ecc status register is fsecc(0x4e000034) 1 mainecclock [5] lock main data area ecc generation 0: unlock main data area ecc generation 1: lock main data area ecc generation main area ecc status register is nfmecc0/1 (0x4e00002c/30) 1 initecc [4] initialize ecc decoder/encoder(write-only) 1: initialize ecc decoder/encoder 0 reserved [2:3] reserved 00 reg_nce [1] nand flash memory nfce signal control 0: force nfce to low (enable chip select) 1: force nfce to high (disable chip select) note: during boot time, it is controlled automatically. this value is only valid while mode bit is 1 1 mode [0] nand flash controller operating mode 0: nand flash controller disable (don?t work) 1: nand flash controller enable 0
S3C2440a risc microprocessor nand flash controller 6- 15 command register register address r/w description reset value nfcmmd 0x4e000008 r/w nand flash command set register 0x00 nfcmmd bit description initial state reserved [15:8] reserved 0x00 nf cmmd [7:0] nand flash memory command value 0x00 address register register address r/w description reset value nfaddr 0x4e00000c r/w nand flash address set register 0x0000xx00 reg_addr bit description initial state reserved [15:8] reserved 0x00 nfaddr [7:0] nand flash memory address value 0x00 data register register address r/w description reset value nfdata 0x4e000010 r/w nand flash data register 0xxxxx nfdata bit description initial state nfdata [31:0] nand flash read/program data value for i/o note: refer to data register configuration in page 6-5. 0xxxxx
nand flash controller S3C2440a risc microprocessor 6- 16 main data area register register address r/w description reset value nfmeccd0 0x4e000014 r/w nand flash ecc 1 st and 2 nd register for main data read note: refer to ecc module features in page 6-8. 0x00000000 nfmeccd1 0x4e000018 r/w nand flash ecc 3 nd 4 th register for main data read note: refer to ecc module features in page 6-8. 0x00000000 nfmeccd0 bit description initial state eccdata1_1 [31:24] 2 nd ecc for i/o[15:8] 0x00 eccdata1_0 [23:16] 2 nd ecc for i/o[ 7:0] note : in software mode, read this register when you need to read 2 nd ecc value from nand flash memory 0x00 eccdata0_1 [15:8] 1 st ecc for i/o[15:8] 0x00 eccdata0_0 [7:0] 1 st ecc for i/o[ 7:0] note: in software mode, read this register when you need to read 1 st ecc value from nand flash memory. this register has same read function of nfdata. 0x00 note: only word access is valid. nfmeccd1 bit description initial state eccdata3_1 [31:24] 4 th ecc for i/o[15:8] 0x00 eccdata3_0 [23:16] 4 th ecc for i/o[ 7:0] note: in software mode, read this register when you need to read 4 th ecc value from nand flash memory. 0x00 eccdata2_1 [15:8] 3 nd ecc for i/o[15:8] 0x00 eccdata2_0 [7:0] 3 nd ecc for i/o[ 7:0] note: in software mode, read this register when you need to read 3 nd ecc value from nand flash memory. this register has same read function of nfdata. 0x00 note: only word access is valid.
S3C2440a risc microprocessor nand flash controller 6- 17 spare area ecc register register address r/w description reset value nfseccd 0x4e00001c r/w nand flash ecc (error correction code) register for spare area data read 0x00000000 nfseccd bit description initial state eccdata1_1 [31:24] 2 nd ecc for i/o[15:8] 0x00 eccdata1_0 [23:16] 2 nd ecc for i/o[ 7:0] note: in software mode, read this register when you need to read 2 nd ecc value from nand flash memory. 0x00 eccdata0_1 [15:8] 1 st ecc for i/o[15:8] 0x00 eccdata0_0 [7:0] 1 st ecc for i/o[ 7:0] note: in software mode, read this register when you need to read 1 st ecc value from nand flash memory. this register has same read function of nfdata. 0x00 note: only word access is valid.
nand flash controller S3C2440a risc microprocessor 6- 18 nfcon status register register address r/w description reset value nfstat 0x4e000020 r/w nand flash operation status register 0xxx00 nfstat bit description initial state reserved [7] reserved x reserved [4:6] reserved 0 illegalaccess [3] once soft lock or lock-tight is enabled, the illegal access (program, erase) to the memory makes this bit set. 0: illegal access is not detected 1: illegal access is detected 0 rnb_transdetect [2] when rnb low to high transition is occurred, this value set and issue interrupt if enabled. to clear this value write ?1?. 0: rnb transition is not detected 1: rnb transition is detected transition configuration is set in rnb_transmode (nfcont[8]). 0 nce (read-only) [1] the status of nce output pin 1 rnb (read-only) [0] the status of rnb input pin. 0: nand flash memory busy 1: nand flash memory ready to operate 1
S3C2440a risc microprocessor nand flash controller 6- 19 ecc0/1 status register register address r/w description reset value nfestat0 0x4e000024 r/w nand flash ecc status register for i/o [7:0] 0x00000000 nfestat1 0x4e000028 r/w nand flash ecc status register for i/o [15:8] 0x00000000 nfestat0 bit description initial state serrordatano [24:21] in spare area, indicates which number data is error 00 serrorbitno [20:18] in spare area, indicates which bit is error 000 merrordatano [17:7] in main data area, indicates which number data is error 0x00 merrorbitno [6:4] in main data area, indicates which bit is error 000 spareerror [3:2] indicates whether spare area bit fail error occurred 00: no error 01: 1-bit error(correctable) 10: multiple error 11: ecc area error 00 mainerror [1:0] indicates whether main data area bit fail error occurred 00: no error 01: 1-bit error(correctable) 10: multiple error 11: ecc area error 00 note : the above value s are only valid when both ecc register and ecc status register have valid value. nfestat1 bit description initial state serrordatano [24:21] in spare area, indicates which number data is error 00 serrorbitno [20:18] in spare area, indicates which bit is error 000 merrordatano [17:7] in main data area, indicates which number data is error 0x00 merrorbitno [6:4] in main data area, indicates which bit is error 000 spareerror [3:2] indicates whether spare area bit fail error occurred 00: no error 01: 1-bit error(correctable) 10: multiple error 11: ecc area error 00 mainerror [1:0] indicates whether main data area bit fail error occurred 00: no error 01: 1-bit error(correctable) 10: multiple error 11: ecc area error 00 note : the above value s are only valid when both ecc register and ecc status register have valid value.
nand flash controller S3C2440a risc microprocessor 6- 20 main data area ecc0 status register register address r/w description reset value nfmecc0 0x4e00002c r nand flash ecc register for data[7:0] 0xxxxxxx nfmecc1 0x4e000030 r nand flash ecc register for data[15:8] 0xxxxxxx nfmecc0 bit description initial state mecc0_3 [31:24] ecc3 for data[7:0] 0xxx mecc0_2 [23:16] ecc2 for data[7:0] 0xxx mecc0_1 [15:8] ecc1 for data[7:0] 0xxx mecc0_0 [7:0] ecc0 for data[7:0] 0xxx nfmecc1 bit description initial state mecc1_3 [31:24] ecc3 data[15:8] 0xxx mecc1_2 [23:16] ecc2 data[15:8] 0xxx mecc1_1 [15:8] ecc1 data[15:8] 0xxx mecc1_0 [7:0] ecc0 data[15:8] 0xxx note: the nand flash controller generate nfmecc0/1 when read or write main area data while the mainecclock(nfcont[5]) bit is ?0?(unlock). spare area ecc status register register address r/w description reset value nfsecc 0x4e000034 r nand flash ecc register for i/o [15:0] 0xxxxxxx nfsecc bit description initial state secc1_1 [31:24] spare area ecc1 status for i/o[15:8] 0xxx secc1_0 [23:16] spare area ecc0 status for i/o[15:8] 0xxx secc0_1 [15:8] spare area ecc1 status for i/o[7:0] 0xxx secc0_0 [7:0] spare area ecc0 status for i/o[7:0] 0xxx note: the nand flash controller generate nfsecc when read or write spare area data while the spareecclock(nfcont[6]) bit is ?0?(unlock).
S3C2440a risc microprocessor nand flash controller 6- 21 block address register register address r/w description reset value nfsblk 0x4e000038 r/w nand flash programmable start block address 0x000000 nfeblk 0x4e00003c r/w nand flash programmable end block address nand flash can be programmed between start and end address. when the soft lock or lock-tight is enabled and the start and end address has same value, entire area of nand flash will be locked. 0x000000 nfsblk bit description initial state sblk_addr2 [23:16] the 3 nd block address of the block erase operation 0x00 sblk_addr1 [15:8] the 2 nd block address of the block erase operation 0x00 sblk_addr0 [7:0] the 1 st block address of the block erase operation (only bit [7:5] are valid) 0x00 note: advance flash?s block address start from 3-address cycle. so block address register only needs 3-bytes. nfeblk bit description initial state eblk_addr2 [23:16] the 3 rd block address of the block erase operation 0x00 eblk_addr1 [15:8] the 2 nd block address of the block erase operation 0x00 eblk_addr0 [7:0] the 1 st block address of the block erase operation (only bit [7:5] are valid) 0x00 note: advance flash?s block address start from 3-address cycle. so block address register only needs 3-bytes.
nand flash controller S3C2440a risc microprocessor 6- 22 the nfslk and nfeblk can be changed while soft lock bit(nfcont[12]) is enabled. but cannot be changed when lock-tight bit(nfcont[13]) is set. when lock-tight =1 or softlock =1 nand flash memory locked area (read only) prorammable/ readable area locked area (read only) nfsblk address high low nfeblk nfeblk-1 nfsblk nfeblk locked area (read only) when nfsblk=nfeblk
S3C2440a risc microprocessor clock & power management 7- 1 7 clock & power management overview the clock & power management block consists of three parts: clock control, usb control, and power control. the clock control logic in S3C2440a can generate the required clock signals including fclk for cpu, hclk for the ahb bus peripherals, and pclk for the apb bus peripherals. the S3C2440a has two phase locked loops (plls): one for fclk, hclk, and pclk, and the other dedicated for usb block (48mhz). the clock control logic can make slow clocks without pll and connect/disconnect the clock to each peripheral block by software, which will reduce the power consumption. for the power control logic, the S3C2440a has various power management schemes to keep optimal power consumption for a given task. the power management block in the S3C2440a can activate four modes: normal mode, slow mode, idle mode, and sleep mode. normal mode: the block supplies clocks to cpu as well as all peripherals in the S3C2440a. in this mode, the power consumption will be maximized when all peripherals are turned on. it allows the user to control the operation of peripherals by software. for example, if a timer is not needed, the user can disconnect the clock(clkcon register) to the timer to reduce power consumption. slow mode: non-pll mode. unlike the normal mode, the slow mode uses an external clock (xtipll or extclk) directly as fclk in the S3C2440a without pll. in this mode, the power consumption depends on the frequency of the external clock only. the power consumption due to pll is excluded. idle mode: the block disconnects clocks (fclk) only to the cpu core while it supplies clocks to all other peripherals. the idle mode results in reduced power consumption due to cpu core. any interrupt request to cpu can be woken up from the idle mode. sleep mode: the block disconnects the internal power. so, there occurs no power consumption due to cpu and the internal logic except the wake-up logic in this mode. activating the sleep mode requires two independent power sources. one of the two power sources supplies the power for the wake-up logic. the other one supplies other internal logics including cpu, and should be controlled for power on/off. in the sleep mode, the second power supply source for the cpu and internal logics will be turned off. the wakeup from sleep mode can be issued by the eint[15:0] or by rtc alarm interrupt.
clock & power management S3C2440a risc microprocessor 7- 2 functional description clock architecture figure 7-1 shows a block diagram of the clock architecture. the main clock source comes from an external crystal (xtipll) or an external clock (extclk). the clock generator includes an oscillator (oscillation amplifier), which is connected to an external crystal, and also has two plls (phase-locked-loop), which generate the high frequency clock required in the S3C2440a. clock source selection table 7-1 shows the relationship between the combination of mode control pins (om3 and om2) and the selection of source clock for the S3C2440a. the om[3:2] status is latched internally by referring the om3 and om2 pins at the rising edge of nreset. table 7-1. clock s ource s election at b oot- u p mode om[3:2] mpll s tate upll s tate main clock source usb clock s ource 00 on on crystal crystal 01 on on crystal extclk 10 on on extclk crystal 11 on on extclk extclk notes: 1. although the mpll starts just aft er a reset, the mpll output (mpll) is not used as the system clock until the software writes valid settings to the mpllcon register. before this valid setting, the clock from external crystal or extclk source will be used as the system clock directly. even if the user does not want to change the default value of mpllcon register, the user should write the same value into mpllcon register. 2. om[3:2] is used to determine a test mode when om[1:0] is 11.
S3C2440a risc microprocessor clock & power management 7- 3 nand flash controller osc mpll upll clkcntl fclk hdivn pdivn mpll control signal upll powcntl f h p usbcntl test mode om[1:0] bus controller memory controller arbitration dma 4ch wdt i 2 s sdi adc uart(0,1,2) pwm i 2 c gpio rtc spi(0,1) usb device arm920t interrupt controller lcd controller h_lcd p_sdi p_gpio p_adc p_rtc p_uart p_spi p_i 2 s p_i 2 c p_pwm p_usb h_nand fclk pclk hclk uclk power management block mpllin clk upll clk hclk pclk rtc xtal clk clkout xtipll xtopll extclk p[5:0] m[7:0] s[1:0] om[3:2] p[5:0] m[7:0] s[1:0] usb host i/f h_usb tic h_cam cam extmater divn_upll 1/1 or 1/2 camdivn p_a97 ac97 mpllin figure 7-1. clock generator block diagram
clock & power management S3C2440a risc microprocessor 7- 4 phase locked loop (pll) the mpll within the clock generator, as a circuit, synchronizes an output signal with a reference input signal in frequency and phase. in this application, it includes the following basic blocks as shown in figure 7-2: the voltage controlled oscillator (vco) to generate the output frequency proportional to input dc voltage, the divider p to divide the input frequency (fin) by p, the divider m to divide the vco output frequency by m which is input to phase frequency detector (pfd), the divider s to divide the vco output frequency by ?s? which is mpll (the output frequency from mpll block), the phase difference detector, the charge pump, and the loop filter. the output clock frequency mpll is related to the reference input clock frequency fin by the following equation: mpll = (2*m * fin) / (p * 2 s ) m = m (the value for divider m)+ 8, p = p (the value for divider p) + 2 the upll within the clock generator is similar to the mpll in every aspect. the following sections describes the operation of the pll, including the phase difference detector, the charge pump, the voltage controlled oscillator (vco), and the loop filter. phase frequency detector (pfd) the pfd monitors the phase difference between fref and fvco, and generates a control signal (tracking signal) when the difference is detected. the fref means the reference frequency as shown in the figure 7-2. charge pump (pump) the charge pump converts pfd control signals into a proportional change in voltage across the external filter that drives the vco. loop filter the control signal, which the pfd generates for the charge pump, may generate large excursions (ripples) each time the fvco is compared to the fref. to avoid overloading the vco, a low pass filter samples and filters the high- frequency components out of the control signal. the filter is typically a single-pole rc filter with a resistor and a capacitor. voltage controlled oscillator (vco) the output voltage from the loop filter drives the vco, causing its oscillation frequency to increase or decrease linearly as a function of variations in average voltage. when the fvco matches fref in terms of frequency as well as phase, the pfd stops sending control signals to the charge pump, which in turn stabilizes the input voltage to the loop filter. the vco frequency then remains constant, and the pll remains fixed onto the system clock. usual conditions for pll & clock generator pll & clock generator generally uses the following conditions. loop filter capacitance c lf mpllcap: 1.3 nf 5% upllcap: 700 pf 5% external x-tal frequency ? 12 ? 20 mhz (note) external capacitance used for x-tal c ext 15 ? 22 pf notes: 1. the value could be changed. 2. fclk out must be bigger than 200mhz (it does not mean that the arm core has to run more than 200mhz).
S3C2440a risc microprocessor clock & power management 7- 5 divider p loop filter fin m[7:0] s[1:0] pfd divider m p[5:0] f vco pump vco divider s f ref mpll,upll r c internal c lf external mpllcap, upllcap figure 7-2. pll (phase-locked loop) block diagram extclk xtipll xtopll extclk xtipll xtopll external osc a) x-tal oscillation (om[3:2]=00) b) external clock source (om[3:2]=11) v dd v dd figure 7-3. main oscillator circuit examples
clock & power management S3C2440a risc microprocessor 7- 6 clock control logic the clock control logic determines the clock source to be used, i.e., the pll clock (mpll) or the direct external clock (xtipll or extclk). when pll is configured to a new frequency value, the clock control logic disables the fclk until the pll output is stabilized using the pll locking time. the clock control logic is also activated at power- on reset and wakeup from power-down mode. power-on reset (xtipll) figure 7-4 shows the clock behavior during the power-on reset sequence. the crystal oscillator begins oscillation within several milliseconds. when nreset is released after the stabilization of osc (xtipll) clock, the pll starts to operate according to the default pll configuration. however, pll is commonly known to be unstable after power-on reset, so fin is fed directly to fclk instead of the mpll (pll output) before the software newly configures the pllcon. even if the user does not want to change the default value of pllcon register after reset, the user should write the same value into pllcon register by software. the pll restarts the lockup sequence toward the new frequency only after the software configures the pll with a new frequency. fclk can be configured as pll output (mpll) immediately after lock time. the logic operates by xtipll nreset osc (xtipll) vco output power clock disable lock time pll is configured by s/w first time. vco is adapted to new clock frequency. fclk fclk is new frequency pll can operate after om[3:2] is latched. figure 7-4. power-on reset sequence (when the external clock source is a crystal oscillator)
S3C2440a risc microprocessor clock & power management 7- 7 change pll settings in normal operation mode during the operation of the S3C2440a in normal mode, the user can change the frequency by writing the pms value and the pll lock time will be automatically inserted. during the lock time, the clock is not supplied to the internal blocks in the S3C2440a. figure 7-5 shows the timing diagram. mpll pms setting pll lock-time fclk it changes to new pll clock after automatic lock time. figure 7-5. changing slow clock by setting pms value usb clock control usb host interface and usb device interface needs 48mhz clock. in the S3C2440a, the usb dedicated pll (upll) generates 48mhz for usb. uclk does not fed until the pll (upll) is configured. condition uclk state upll state after reset xtlpll or extclk on after upll configuration l: during pll lock time 48mhz: after pll lock time on upll is turned off by clkslow register xtlpll or extclk off upll is turned on by clkslow register 48mhz on
clock & power management S3C2440a risc microprocessor 7- 8 fclk, hclk, and pclk fclk is used by arm920t. hclk is used for ahb bus, which is used by the arm920t, the memory controller, the interrupt controller, the lcd controller, the dma and usb host block. pclk is used for apb bus, which is used by the peripherals such as wdt, iis, i2c, pwm timer, mmc interface, adc, uart, gpio, rtc and spi. the S3C2440a supports selection of dividing ratio between fclk, hlck and pclk. this ratio is determined by hdivn and pdivn of clkdivn control register. hdivn pdivn hclk3_half/ hclk4_half fclk hclk pclk divide ratio 0 0 ? fclk fclk fclk 1 : 1 : 1 (default) 0 1 ? fclk fclk fclk / 2 1 : 1 : 2 1 0 ? fclk fclk / 2 fclk / 2 1 : 2 : 2 1 1 ? fclk fclk / 2 fclk / 4 1 : 2 : 4 3 0 0 / 0 fclk fclk / 3 fclk / 3 1 : 3 : 3 3 1 0 / 0 fclk fclk / 3 fclk / 6 1 : 3 : 6 3 0 1 / 0 fclk fclk / 6 fclk / 6 1 : 6 : 6 3 1 1 / 0 fclk fclk / 6 fclk / 12 1 : 6 : 12 2 0 0 / 0 fclk fclk / 4 fclk / 4 1 : 4 : 4 2 1 0 / 0 fclk fclk / 4 fclk / 8 1 : 4 : 8 2 0 0 / 1 fclk fclk / 8 fclk / 8 1 : 8 : 8 2 1 0 / 1 fclk fclk / 8 fclk / 16 1 : 8 : 16 after setting pms value, it is required to set clkdivn register. the value set for clkdivn will be valid after pll lock time. the value is also available for reset and changing power management mode. the setting value can also be valid after 1.5 hclk. only, 1hclk can validate the value of clkdivn register changed from default (1:1:1) to other divide ratio (1:1:2, 1:2:2, 1:2:4). 1 hclk 1.5 hclk 1.5 hclk 0x00000000 0x00000001(1:1:2) 0x00000003 (1:2:4) 0x00000000 (1:1:1) clkdivn fclk hclk pclk figure 7-6. example of internal clock change
S3C2440a risc microprocessor clock & power management 7- 9 notes 1. clkdivn should be set carefully not to exceed the limit of hclk and pclk. 2. if hdivn is not 0, the cpu bus mode has to be changed from the fast bus mode to the asynchronous bus mode using following instructions(S3C2440 does not support synchronous bus mode). mmu_setasyncbusmode mrc p15,0,r0,c1,c0,0 orr r0,r0,#r1_nf:or:r1_ia mcr p15,0,r0 ,c1,c0,0 if hdivn is not 0 and the cpu bus mode is the fast bus mode, the cpu will operate by the hclk. this feature can be used to change the cpu frequency as a half or more without affecting the hclk and pclk.
clock & power management S3C2440a risc microprocessor 7- 10 power management the power management block controls the system clocks by software for the reduction of power consumption in the S3C2440a. these schemes are related to pll, clock control logics (fclk, hclk, and pclk) and wakeup signals. figure 7-7 shows the clock distribution of the S3C2440a. the S3C2440a has four power modes. the following section describes each power management mode. the transition between the modes is not allowed freely. please see figure 7-8 for available transitions among the modes. intcntl power management fclk input clock fclk defination if slow mode fclk = input clock/divider ratio if normal mode (p, m & s value) fclk = mpll clock (mpll) arm920t hclk pclk upll(96/48 mhz) buscntl memcntl arb/dma extmaster lcdcntl nand flash controller camera wdt spi pwm i2c sdi adc uart i2s gpio rtc usb device clock control register usb host i/f 1/d 1/2 1/1 ac97 1/n mpllin figure 7-7. the clock distribution block diagram
S3C2440a risc microprocessor clock & power management 7- 11 idle sleep normal (slow_bit=0) slow (slow_bit=1) idle_bit=1 interrupts, eint[0:23], rtc alarm sleep bit=1 eint[15:0], rtc alarm reset figure 7-8. power management state diagram table 7-2. clock and power state in each power mode mode arm920t ahb modules (1) /wdt power management gpio 32.768k h z rtc clock apb modules (2) & usbh/lcd/nand normal o o o sel o sel idle x o o sel o sel slow o o o sel o sel sleep off off wait for wake- up event previous state o off notes: 1. usb host,lcd, and nand are excluded. 2. wdt is excluded. rtc interface for cpu access is included. 3. sel : selectable(o,x), o : enable , x : disable off: power is turned off
clock & power management S3C2440a risc microprocessor 7- 12 normal mode in normal mode, all peripherals and the basic blocks including power management block, the cpu core, the bus controller, the memory controller, the interrupt controller, dma, and the external master may operate completely. but, the clock to each peripheral, except the basic blocks, can be stopped selectively by software to reduce the power consumption. idle mode in idle mode, the clock to the cpu core is stopped except the bus controller, the memory controller, the interrupt controller, and the power management block. to exit the idle mode, eint[23:0], or rtc alarm interrupt, or the other interrupts should be activated. (eint is not available until gpio block is turned on). slow mode (non-pll mode) power consumption can be reduced in the slow mode by applying a slow clock and excluding the power consumption from the pll. the fclk is the frequency of divide_by_n of the input clock (xtipll or extclk) without pll. the divider ratio is determined by slow_val in the clkslow control register and clkdivn control register. table 7-3. clkslow and clkdivn register settings for slow clock example slow_val fclk hclk pclk uclk 1/1 option (hdivn=0) 1/2 option (hdivn=1) 1/1 option (pdivn=0) 1/2 option (pdivn=1) 0 0 0 extclk or xtipll / 1 extclk or xtipll / 1 extclk or xtipll / 2 hclk hclk / 2 48 mhz 0 0 1 extclk or xtipll / 2 extclk or xtipll / 2 extclk or xtipll / 4 hclk hclk / 2 48 mhz 0 1 0 extclk or xtipll / 4 extclk or xtipll / 4 extclk or xtipll / 8 hclk hclk / 2 48 mhz 0 1 1 extclk or xtipll / 6 extclk or xtipll / 6 extclk or xtipll / 12 hclk hclk / 2 48 mhz 1 0 0 extclk or xtipll / 8 extclk or xtipll / 8 extclk or xtipll / 16 hclk hclk / 2 48 mhz 1 0 1 extclk or xtipll / 10 extclk or xtipll / 10 extclk or xtipll / 20 hclk hclk / 2 48 mhz 1 1 0 extclk or xtipll / 12 extclk or xtipll / 12 extclk or xtipll / 24 hclk hclk / 2 48 mhz 1 1 1 extclk or xtipll / 14 extclk or xtipll / 14 extclk or xtipll / 28 hclk hclk / 2 48 mhz in slow mode, pll will be turned off to reduce the pll power consumption. when the pll is turned off in the slow mode and the user changes power mode from slow mode to normal mode, then the pll needs clock stabilization time (pll lock time). this pll stabilization time is automatically inserted by the internal logic with lock time count register. the pll stability time will take 300us after the pll is turned on. during pll lock time, the fclk becomes slow clock.
S3C2440a risc microprocessor clock & power management 7- 13 users can change the frequency by enabling slow mode bit in clkslow register in pll on state. the slow clock is generated during the slow mode. figure 7-11(please check the figure correctly) shows the timing diagram. mpll slow mode disable fclk slow mode enable slow_bit divided external clock mpll_off it changes to pll clock after slow mode off figure 7-9. issuing exit_from_slow_mode c ommand in pll on s tate if the user switches from slow mode to normal mode by disabling the slow_bit in the clkslow register after pll lock time, the frequency is changed just after slow mode is disabled. figure 7-12 (please check for the figure number correctly) shows the timing diagram. mpll fclk slow_bit divided osc clock mpll_off software lock time slow mode disable pll off pll on slow mode enable it changes to pll clock after slow mode off figure 7-10. issuing exit_from_slow_mode c ommand a fter l ock t ime
clock & power management S3C2440a risc microprocessor 7- 14 if the user switches from slow mode to normal mode by disabling slow_bit and mpll_off bit simultaneously in the clkslow register, the frequency is changed just after the pll lock time. figure 7-13 (please check for the figure number correctly) shows the timing diagram. mpll fclk slow_bit divided osc clock mpll_off hardware lock time pll off pll on slow mode enable it changes to pll clock after lock time automatically slow mode disable figure 7-11. issuing exit_from_slow_mode c ommand and the i nstant pll_on c ommand s imultaneously
S3C2440a risc microprocessor clock & power management 7- 15 sleep mode the block disconnects the internal power. so, there occurs no power consumption due to cpu and the internal logic except the wake-up logic in this mode. activating the sleep mode requires two independent power sources. one of the two power sources supplies the power for the wake-up logic. the other one supplies other internal logics including cpu, and should be controlled for power on/off. in the sleep mode, the second power supply source for the cpu and internal logics will be turned off. the wakeup from sleep mode can be issued by the eint[15:0] or by rtc alarm interrupt. follow the procedure to enter sleep mode 1. set the gpio configuration adequate for sleep mode. 2. mask all interrupts in the intmsk register. 3. configure the wake-u p sources properly including rtc alarm. (the bit of eintmask corresponding to the wake- up source has not to be masked in order to let the corresponding bit of srcpnd or eintpend set. although a wake-up source is issued and the corresponding bit of eintmask is masked, the wake-up will occur and the corresponding bit of srcpnd or eintpend will not be set.) 4. set usb pads as suspend mode. (misccr[13:12]=11b) 5. save some meaning values into gstatus[4:3] register. these register are preserved during sleep mode . 6. configure misccr[1:0] for the pull-up resisters on the data bus,d[31:0]. if there is an external bus holder, such as 74lvch162245, turn off the pull-up resistors. if not, turn on the pull-up resistors. additionally, the memory concerning pins is set to two types, one is hi-z, and the other is inactive state. 7. stop lcd by clearing lcdcon1.envid bit. 8. read rrefresh and rclkcon registers in order to fill the tlb. 9. let sdram enter the self-refresh mode by setting the refresh[22]=1b. 10. wait until sd ram self-refresh is effective. 11. set misccr[19:17]=111b to make sdram signals(sclk0,sclk1 and scke) protected during sleep mode 12. set the sleep mode bit in the clkcon register. caution: when the system is operating in nand boot mode, the hardware pin configuration - eint[23:21] ? must be set as input for starting up after wakeup from sleep mode.
clock & power management S3C2440a risc microprocessor 7- 16 follow the procedure to wake-up from sleep mode 1. the internal reset signal will be asserted if one of the wake-up sources is issued. it?s exactly same with the case of the assertion of the external nreset pin. this reset duration is determined by the internal 16-bit counter logic and the reset assertion time is calculated as trst = (65535 / xtal_frequency). 2. check gstatus2[2] in order to know whether or not the power-up is caused by the wake-up from sleep mode. 3. release the sdram signal protection by setting misccr[19:17]=000b. 4. configure the sdram memory controller. 5. wait until the sdram self-refresh is released. mostly sdram needs the refresh c ycle of all sdram row. 6. the information in gstatus[3:4] can be used for user?s own purpose because the value in gstatus[3:4] has been preserved during sleep mode. 7. ? for eint[3:0], check the srcpnd register. ? for eint[15:4], check the eintpend instead of srcpnd (srcpnd will not be set although some bits of eintpend are set.). table 7-4. pin configuration table in sleep mode pin condition guid of pin configuration gpio pin which are configured as input pull-up enable which are configured as ouput pull-up disable and output low input pin, which doesn't have internal pull-up control. if external device doesn't always drive pin's level. pull-up enable by external pull-up resistor output pin, which are connected to external device if external device's power is off output low if external device's power is on high or low (it depends on external device's status) data bus if memory power is off output low if memory power is on and external buffer does exist if buffer can hold bus level, pull-up disable. and no external buffer output low note: 1. adc should be set to standby mode. 2. usb pads should be suspend mode. * this table is just for informational use only. user should consider his own board condition and application.
S3C2440a risc microprocessor clock & power management 7- 17 power control of vddi and vddiarm in sleep mode, vddi, vddiarm, vddmpll and vddupll will be turned off, which is controlled by pwren pin. if pwren signal is activated(h), vddi and vddiarm are supplied by an external voltage regulator. if pwren pin is inactive (l), the vddi and vddiarm are turned off. note although vddi, vddiarm, vddmpll and vddupll may be turned off, the other power pins have to be supplied. S3C2440a power ctrl (alive block) rtc alarm eint external interrupt 3.3v power pwren vddi vddiarm vddmpll vddupll core & peripherals rtc i/o regulator 1.2v/1.3v en 1.2v/1.3v power vddalive adc 1.8v~3.6v memory interface 1.8v/2.5v/3.3v 3.3v figure 7-12. sleep mode note during sleep mode, if you don?t use touch screen panel, touch ports (xp, xm, yp, and ym) must be floating. that is, touch ports (xp, xm, yp, and ym) shouldn?t be connected to gnd sources. because xp,yp will be maintained h during sleep mode.
clock & power management S3C2440a risc microprocessor 7- 18 signaling eint[15:0] for wakeup the S3C2440a can be woken up from sleep mode only if the following conditions are met. a) level signals (h or l) or edge signals (rising, falling or both) are asserted on eintn input pin. b) the eintn pin has to be configured as eint in the gpio control register. c) nbatt_flt pin has to be h level. it is important to configure the eintn in the gpio control register as an external interrupt pins, considering the condition a) above. just after the wake-up, the corresponding eintn pin will not be used for wakeup. this means that the pin can be used as an external interrupt request pin again. entering idle mode if clkcon[2] is set to 1 to enter the idle mode, the S3C2440a will enter idle mode after some delay (until the power control logic receives ack signal from the cpu wrapper). pll on/off the pll can only be turned off for low power consumption in slow mode. if the pll is turned off in any other mode, mcu operation is not guaranteed. when the processor is in slow mode and tries to change its state into other state with the pll turned on, then slow_bit should be clear to move to another state after pll stabilization pull-up resistors on the data bus and sleep mode in sleep mode, the data bus (d[31:0] or d[15:0] ) can be selected as hi-z state and output low state. the data bus can be set as hi-z status with turning on pull-up register or can be set as output low with turning off pull-up register for low power consumption in sleep mode. d[31:0] pin pull-up resistors can be controlled by the gpio control register (misccr). however, if there is an external bus holder, such as 74lvch162245, on the data bus, user can select one of two status ? one is output low with pull-up off, the other is hi-z with pull-up off - , which consumes less power.
S3C2440a risc microprocessor clock & power management 7- 19 output port state and sleep mode the output port should have a proper logic level in power off mode, which makes the current consumption minimized. if there is no load on an output port pin, h level is preferred. if output is l, the current will be consumed through the internal parasitic resistance; if the output is h, the current will not be consumed. for an output port, the current consumption can be reduced if the output state is h. it is recommended that the output ports be in h state to reduce current consumption in sleep mode. battery fault signal (nbatt_flt) there are two functions in nbatt_flt pin, they are as follows; ? when cpu is not in sleep mode, nbatt_flt pin will cause the interrupt request by setting batt_func(misccr[22:20]) as 10x?b. the interrupt attribute of the nbatt_flt is l-level triggered. ? while cpu is in sleep mode, assertion of the nbatt_flt will prohibit the wake up from the sleep mode, which is achieved by setting batt_func(misccr[22:20]) as 11x?b. so, any wake-up source will be masked if nbatt_flt is asserted, which is protecting the system malfunction of the low battery capacity adc power down the adc has an additional power-down bit in adccon. if the S3C2440a enters the sleep mode, the adc should enter its own power-down mode.
clock & power management S3C2440a risc microprocessor 7- 20 clock generator & power management special register lock time count register (locktime) register address r/w description reset value locktime 0x4c000000 r/w pll lock time count register 0xffffffff locktime bit description initial state u_ltime [31:16] upll lock time count value for uclk. (u_ltime > 300us) 0xffff m_ltime [15:0] mpll lock time count value for fclk, hclk, and pclk (m_ltime > 300us) 0xffff mpll control register mpll = (2 * m * fin) / (p * 2 s ) m = (mdiv + 8), p = (pdiv + 2), s = sdiv upll control register upll = (m * fin) / (p * 2 s ) m = (mdiv + 8), p = (pdiv + 2), s = sdiv pll value selection guide (mpllcon) 1. f out = 2 * m * fin / (p*2 s ), f vco = 2 * m * fin / p where: m=mdiv+8, p=pdiv+2, s=sdiv 2. 600mhz f vco 1.2ghz 3. 200mhz fclk out 600mhz 4. don't set the p or m value as zero, that is, setting the p=000000, m=00000000 can cause malfunction of the pll. 5. the proper range of p and m: 1 p 62, 1 m 248 note although there is the rule for choosing pll value, we recommend only the values in the pll value recommendation table. if you have to use another value, please contact us.
S3C2440a risc microprocessor clock & power management 7- 21 pll control register (mpllcon & upllcon) register address r/w description reset value mpllcon 0x4c000004 r/w mpll configuration register 0x00096030 upllcon 0x4c000008 r/w upll configuration register 0x0004d030 pllcon bit description initial state mdiv [19:12] main divider control 0x96 / 0x4d pdiv [9:4] pre-divider control 0x03 / 0x03 sdiv [1:0] post divider control 0x0 / 0x0 note: when you set mpll&upll values, you have to set the upll value first and then the mpll value. (needs intervals approximately 7 nop) pll value selection table it is not easy to find a proper pll value. so, we recommend referring to the following pll value recommendation table. input frequency output frequency mdiv pdiv sdiv 12.0000mhz 48.00 mhz (note) 56(0x38) 2 2 12.0000mhz 96.00 mhz (note) 56(0x38) 2 1 12.0000mhz 271.50 mhz 173(0xad) 2 2 12.0000mhz 304.00 mhz 68(0x44) 1 1 12.0000mhz 405.00 mhz 127(0x7f) 2 1 12.0000mhz 532.00 mhz 125(0x7d) 1 1 16.9344mhz 47.98 mhz (note) 60(0x3c) 4 2 16.9344mhz 95.96 mhz (note) 60(0x3c) 4 1 16.9344mhz 266.72 mhz 118(0x76) 2 2 16.9344mhz 296.35 mhz 97(0x61) 1 2 16.9344mhz 399.65 mhz 110(0x6e) 3 1 16.9344mhz 530.61 mhz 86(0x56) 1 1 16.9344mhz 533.43 mhz 118(0x76) 1 1 note: the 48.00mhz and 96mhz output is used for upllcon register.
clock & power management S3C2440a risc microprocessor 7- 22 clock control register (clkcon) register address r/w description reset value clkcon 0x4c00000c r/w clock generator control register 0xfffff0 clkcon bit description initial state ac97 [20] control pclk into ac97 block. 0 = disable, 1 = enable 1 camera [19] control hclk into camera block. 0 = disable, 1 = enable 1 spi [18] control pclk into spi block. 0 = disable, 1 = enable 1 iis [17] control pclk into iis block. 0 = disable, 1 = enable 1 iic [16] control pclk into iic block. 0 = disable, 1 = enable 1 adc(&touch screen) [15] control pclk into adc block. 0 = disable, 1 = enable 1 rtc [14] control pclk into rtc control block. even if this bit is cleared to 0, rtc timer is alive. 0 = disable, 1 = enable 1 gpio [13] control pclk into gpio block. 0 = disable, 1 = enable 1 uart2 [12] control pclk into uart2 block. 0 = disable, 1 = enable 1 uart1 [11] control pclk into uart1 block. 0 = disable, 1 = enable 1 uart0 [10] control pclk into uart0 block. 0 = disable, 1 = enable 1 sdi [9] control pclk into sdi interface block. 0 = disable, 1 = enable 1 pwmtimer [8] control pclk into pwmtimer block. 0 = disable, 1 = enable 1 usb device [7] control pclk into usb device block. 0 = disable, 1 = enable 1 usb host [6] control hclk into usb host block. 0 = disable, 1 = enable 1 lcdc [5] control hclk into lcdc block. 0 = disable, 1 = enable 1 nand flash controller [4] control hclk into nand flash controller block. 0 = disable, 1 = enable 1 sleep [3] control sleep mode of S3C2440a. 0 = disable, 1 = transition to sleep mode 0 idle bit [2] enter idle mode. this bit is not cleared automatically. 0 = disable, 1 = transition to idle mode 0 reserved [1:0] reserved 0
S3C2440a risc microprocessor clock & power management 7- 23 clock slow control (clkslow) register register address r/w description reset value clkslow 0x4c000010 r/w slow clock control register 0x00000004 clkslow bit description initial state uclk_on [7] 0: uclk on (upll is also turned on and the upll lock time is inserted automatically.) 1: uclk off (upll is also turned off.) 0 reserved [6] reserved ? mpll_off [5] 0: turn on pll. after pll stabilization time (minimum 300us), slow_bit can be cleared to 0. 1: turn off pll. pll is turned off only when slow_bit is 1. 0 slow_bit [4] 0 : fclk = mpll (mpll output) 1: slow mode fclk = input clock/(2xslow_val), when slow_val>0 fclk = input clock, when slow_val=0. input clock = xtipll or extclk 0 reserved [3] ? ? slow_val [2:0] the divider value for the slow clock when slow_bit is on. 0x4
clock & power management S3C2440a risc microprocessor 7- 24 clock divider control (clkdivn) register register address r/w description reset value clkdivn 0x4c000014 r/w clock divider control register 0x00000000 clkdivn bit description initial state divn_upll [3] uclk select register(uclk must be 48mhz for usb) 0: uclk = upll clock 1: uclk = upll clock / 2 set to 0, when upll clock is set as 48mhz set to 1. when upll clock is set as 96mhz. 0 hdivn [2:1] 00 : hclk = fclk/1. 01 : hclk = fclk/2. 10 : hclk = fclk/4 when camdivn[9] = 0. hclk= fclk/8 when camdivn[9] = 1. 11 : hclk = fclk/3 when camdivn[8] = 0. hclk = fclk/6 when camdivn[8] = 1. 00 pdivn [0] 0: pclk has the clock same as the hclk/1. 1: pclk has the clock same as the hclk/2. 0
S3C2440a risc microprocessor clock & power management 7- 25 camera clock divider (camdivn) register register address r/w description reset value camdivn 0x4c000018 r/w camera clock divider register 0x00000000 camdivn bit description initial state dvs_en [12] 0:dvs off arm core will run normally with fclk (mpllout). 1:dvs on arm core will run at the same clock as system clock (hclk). 0 reserved [11] ? 0 reserved [10] ? 0 hclk4_half [9] hdivn division rate change bit, when clkdivn[2:1]=10b. 0: hclk = fclk/4 1: hclk= fclk/8 refer the clkdiv register. 0 hclk3_half [8] hdivn division rate change bit, when clkdivn[2:1]=11b. 0: hclk = fclk/3 1: hclk= fclk/6 refer the clkdiv register. 0 camclk_sel [4] 0:use camclk with upll output (camclk=upll output). 1:camclk is divided by camclk_div value. 0 camclk_div [3:0] camclk divide factor setting register(0 ? 15). camera clock = upll / [(camclk_div +1)x2]. this bit is valid when camclk_sel=1. 0
S3C2440a risc microprocessor dma 8- 1 8 dma overview the S3C2440a supports four-channel dma controller located between the system bus and the peripheral bus. each channel of dma controller can perform data movements between devices in the system bus and/or peripheral bus with no restrictions. in other words, each channel can handle the following four cases: 1. both source and destination are in the system bus 2. the source is in the system bus while the destination is in the peripheral bus 3. the source is in the peripheral bus while the destination is in the system bus 4. both source and destination are in the peripheral bus the main advantage of the dma is that it can transfer the data without cpu intervention. the operation of dma can be initiated by software, or requests from internal peripherals or external request pins.
dma S3C2440a risc microprocessor 8- 2 dma request sources each channel of the dma controller can select one of the dma request source among four dma sources, if h/w dma request mode is selected by dcon register. (note that if s/w request mode is selected, this dma request sources have no meaning at all.) table 8-1 shows four dma sources for each channel. table 8-1. dma request sources for each channel source0 source1 source2 source3 source4 source5 source6 ch-0 nxdreq0 uart0 sdi timer usb device ep1 i2ssdo pcmin ch-1 nxdreq1 uart1 i2ssdi spi0 usb device ep2 pcmout sdi ch-2 i2ssdo i2ssdi sdi timer usb device ep3 pcmin micin ch-3 uart2 sdi spi1 timer usb device ep4 micin pcmout here, nxdreq0 and nxdreq1 represent two external sources (external devices), and i2ssdo and i2ssdi represent iis transmitting and receiving, respectively. dma operation dma uses three-state fsm (finite state machine) for its operation, which is described in the three following steps: state-1. as an initial state, the dma waits fo r a dma request. once the request is reached it goes to state- 2. at this state, dma ack and int req are 0. state-2. in this state, dma ack becomes 1 and the counter (curr_tc) is loaded from dcon[19:0] register. note that the dma ack remains 1 until it is cleared later. state-3. in this state, sub-fsm which handles the atomic operation of dma is initiated. the sub-fsm reads the data from the source address and then writes it to destination address. in this operation, data size and transfer size (single or burst) are considered. this operation is repeated until the counter (curr_tc) becomes 0 in whole service mode, while performed only once in single service mode. the main fsm (this fsm) counts down the curr_tc when the sub-fsm finishes each of atomic operation. in addition, this main fsm asserts the int req signal when curr_tc becomes 0 and the interrupt setting of dcon[29] register is set to 1. in addition, it clears dma ack .if one of the following conditions is met. 1) curr_tc becomes 0 in the whole service mode 2) atomic operation finishes in the single service mode. note that in the single service mode, these three states of main fsm are performed and then stops, and wait for another dma req. and if dma req comes in, all three states are repeated. therefore, dma ack is asserted and then de-asserted for each atomic transfer. in contrast, in the whole service mode, main fsm waits at state-3 until curr_tc becomes 0. therefore, dma ack is asserted during all the transfers and then de-asserted when tc reaches 0. however, int req is asserted only if curr_tc becomes 0 regardless of the service mode (single service mode or whole service mode).
S3C2440a risc microprocessor dma 8- 3 external dma dreq/dack protocol there are three types of external dma request/acknowledge protocols (single service demand, single service handshake and whole service handshake mode). each type defines how the signals like dma request and acknowledge are related to these protocols. basic dma timing the dma service means performing paired reads and writes cycles during dma operation, which can make one dma operation. figure 8-1 shows the basic timing in the dma operation of the S3C2440a. ? the setup time and the delay time of xnxdreq and xnxdack are the same in all the modes. ? if the completion of xnxdreq meets its setup time, it is synchronized twice and then xnxdack is asserted. ? after assertion of xnxdack, dma requests the bus and if it gets the bus it performs its operations. xnxdack is de-asserted when dma operation is completed. xsclk 9.3ns setup 9.3ns setup 6.8ns delay 6.6ns delay read write min. 2xsclk xnxdreq xnxdack min. 3xsclk figure 8-1. basic dma timing diagram
dma S3C2440a risc microprocessor 8- 4 demand/handshake mode comparison demand and handshake modes are related to the protocol between xnxdreq and xnxdack. figure 8-2 shows the differences between the two modes. at the end of one transfer (single/burst transfer), dma checks the state of double-synched xnxdreq. demand mode ? if xnxdreq remains asserted, the next transfer starts immediately. otherwise it waits for xnxdreq to be asserted. handshake mode ? if xnxdreq is de- asserted, dma de-asserts xnxdack in 2cycles. otherwise it waits until xnxdreq is de-asserted. caution: xnxdreq has to be asserted (low) only after the de-assertion (high) of xnxdack. demand mode xsclk xnxdack xnxdack xnxdreq xnxdreq 2cycles double synch read write read write handshake mode bus acquisiton actual transfer 1st transfer 2nd transfer 2cycles read write double synch 2cycles figure 8-2. demand/handshake mode comparison
S3C2440a risc microprocessor dma 8- 5 transfer size ? there are two different transfer sizes; unit and burst 4. ? dma holds the bus firmly during the transfer of the chunk of data. thus, other bus masters cannot get the bus. burst 4 transfer size there will be four sequential reads and writes performed in the burst 4 transfer respectively. note unit transfer size: one read and one write is performed. xsclk xnxdreq xnxdack read read read write write write read write 3 cycles double synch figure 8-3. burst 4 transfer size
dma S3C2440a risc microprocessor 8- 6 examples single service in demand mode with unit transfer size the assertion of xnxdreq will be a need for every unit transfer (single service mode). the operation continues while the xnxdreq is asserted (demand mode), and one pair of read and write (single transfer size) is performed. xnxdreq xnxdack xsclk read write read write double synch figure 8-4. single service in demand mode with unit transfer size single service in handshake mode with unit transfer size xnxdreq xnxdack xsclk read write read write 2cycles double synch figure 8-5. single service in handshake mode with unit transfer size whole service in handshake mode with unit transfer size xnxdreq xnxdack xsclk read write read write double synch figure 8-6. whole service in handshake mode with unit transfer size
S3C2440a risc microprocessor dma 8- 7 dma special registers each dma channel has nine control registers (36 in total since there are four channels for dma controller). six of the control registers control the dma transfer, and other three ones monitor the status of dma controller. the details of those registers are as follows. dma initial source ( disrc ) register register address r/w description reset value disrc0 0x4b000000 r/w dma 0 initial source register 0x00000000 disrc1 0x4b000040 r/w dma 1 initial source register 0x00000000 disrc2 0x4b000080 r/w dma 2 initial source register 0x00000000 disrc3 0x4b0000c0 r/w dma 3 initial source register 0x00000000 disrcn bit description initial state s_addr [30:0] base address (start address) of source data to transfer. this bit value will be loaded into curr_src only if the curr_src is 0 and the dma ack is 1. 0x00000000 dma initial source control ( disrcc ) register register address r/w description reset value disrcc0 0x4b000004 r/w dma 0 initial source control register 0x00000000 disrcc1 0x4b000044 r/w dma 1 initial source control register 0x00000000 disrcc2 0x4b000084 r/w dma 2 initial source control register 0x00000000 disrcc3 0x4b0000c4 r/w dma 3 initial source control register 0x00000000 disrccn bit description initial state loc [1] bit 1 is used to select the location of source. 0: the source is in the system bus (ahb). 1: the source is in the peripheral bus (apb). 0 inc [0] bit 0 is used to select the address increment. 0 = increment 1= fixed if it is 0, the address is increased by its data size after each transfer in burst and single transfer mode. if it is 1, the address is not changed after the transfer. (in the burst mode, address is increased during the burst transfer, but the address is recovered to its first value after the transfer.) 0
dma S3C2440a risc microprocessor 8- 8 dma initial destination (didst) register register address r/w description reset value didst0 0x4b000008 r/w dma 0 initial destination register 0x00000000 didst1 0x4b000048 r/w dma 1 initial destination register 0x00000000 didst2 0x4b000088 r/w dma 2 initial destination register 0x00000000 didst3 0x4b0000b8 r/w dma 3 initial destination register 0x00000000 didstn bit description initial state d_addr [30:0] base address (start address) of destination for the transfer. this bit value will be loaded into curr_src only if the curr_dst is 0 and the dma ack is 1. 0x00000000 dma initial destination control (didstc) register register address r/w description reset value didstc0 0x4b00000c r/w dma 0 initial destination control register 0x00000000 didstc1 0x4b00004c r/w dma 1 initial destination control register 0x00000000 didstc2 0x4b00008c r/w dma 2 initial destination control register 0x00000000 didstc3 0x4b0000cc r/w dma 3 initial destination control register 0x00000000 didstcn bit description initial state chk_int [2] select interrupt occurrence time when auto reload is setting. 0: interrupt will occur when tc reaches 0. 1: interrupt will occur after auto-reload is performed. 0 loc [1] bit 1 is used to select the location of destination. 0: the destination is in the system bus (ahb). 1: the destination is in the peripheral bus (apb). 0 inc [0] bit 0 is used to select the address increment. 0 = increment 1 = fixed if it is 0, the address is increased by its data size after each transfer in burst and single transfer mode. if it is 1, the address is not changed after the transfer. (in the burst mode, address is increased during the burst transfer, but the address is recovered to its first value after the transfer.) 0
S3C2440a risc microprocessor dma 8- 9 dma control (dcon) register register address r/w description reset value dcon0 0x4b000010 r/w dma 0 control register 0x00000000 dcon1 0x4b000050 r/w dma 1 control register 0x00000000 dcon2 0x4b000090 r/w dma 2 control register 0x00000000 dcon3 0x4b0000d0 r/w dma 3 control register 0x00000000 dconn bit description initial state dmd_hs [31] select one between demand mode and handshake mode. 0: demand mode will be selected. 1: handshake mode will be selected. in both modes, dma controller starts its transfer and asserts dack for a given asserted dreq. the difference between the two modes is whether it waits for the de-asserted dack or not. in the handshake mode, dma controller waits for the de-asserted dreq before starting a new transfer. if it finds the de-asserted dreq, it de-asserts dack and waits for another asserted dreq. in contrast, in the demand mode, dma controller does not wait until the dreq is de-asserted. it just de-asserts dack and then starts another transfer if dreq is asserted. we recommend using handshake mode for external dma request sources to prevent unintended starts of new transfers. 0 sync [30] select dreq/dack synchronization. 0: dreq and dack are synchronized to pclk (apb clock). 1: dreq and dack are synchronized to hclk (ahb clock). therefore, for devices attached to ahb system bus, this bit has to be set to 1, while for those attached to apb system, it should be set to 0. for the devices attached to external systems, the user should select this bit depending on which the external system is synchronized with between ahb system and apb system. 0 int [29] enable/disable the interrupt setting for curr_tc (terminal count) 0: curr_tc interrupt is disabled. the user has to view the transfer count in the status register (i.e. polling). 1: interrupt request is generated when all the transfer is done (i.e. curr_tc becomes 0). 0 tsz [28] select the transfer size of an atomic transfer (i.e. transfer performed each time dma owns the bus before releasing the bus). 0: a unit transfer is performed. 1: a burst transfer of length four is performed. 0
dma S3C2440a risc microprocessor 8- 10 dma control (dcon) register ( continued ) dconn bit description initial state servmode [27] select the service mode between single service mode and whole service mode. 0: single service mode is selected in which after each atomic transfer (single or burst of length four) dma stops and waits for another dma request. 1: whole service mode is selected in which one request gets atomic transfers to be repeated until the transfer count reaches to 0. in this mode, additional request are not required. note that even in the whole service mode, dma releases the bus after each atomic transfer and then tries to re-get the bus to prevent starving of other bus masters. 0 hwsrcsel [26:24] select dma request source for each dma. dcon0: 000:nxdreq0 001:uart0 010:sdi 011:timer 100:usb device ep1 dcon1: 000:nxdreq1 001:uart1 010:i2ssdi 011:spi 100:usb device ep2 dcon2: 000:i2ssdo 001:i2ssdi 010:sdi 011:timer 100:usb device ep3 dcon3: 000:uart2 001:sdi 010:spi 011:timer 100:usb device ep4 dcon0: 101:i2ssdo 110:pcmin dcon1: 101:pcmout 110:sdi dcon2: 101:pcmin 110:micin dcon3: 101:micin 110:pcmout these bits control the 4-1 mux to select the dma request source of each dma. these bits have meanings only if h/w request mode is selected by dconn[23]. 00 swhw_sel [23] select the dma source between software (s/w request mode) and hardware (h/w request mode). 0: s/w request mode is selected and dma is triggered by setting sw_trig bit of dmasktrig control register. 1: dma source selected by bit[26:24] triggers the dma operation. 0 reload [22] set the reload on/off option. 0: auto reload is performed when a current value of transfer count becomes 0 (i.e. all the required transfers are performed). 1: dma channel (dma req) is turned off when a current value of transfer count becomes 0. the channel on/off bit (dmasktrign[1]) is set to 0 (dreq off) to prevent unintended further start of new dma operation. 0
S3C2440a risc microprocessor dma 8- 11 dma control (dcon) register ( continued ) dconn bit description initial state dsz [21:20] data size to be transferred. 00 = byte 01 = half word 10 = word 11 = reserved 00 tc [19:0] initial transfer count (or transfer beat). note that the actual number of bytes that are transferred is computed by the following equation: dsz x tsz x tc. where, dsz, tsz (1 or 4), and tc represent data size dconn[21:20], transfer size dconn[28], and initial transfer count, respectively. this value will be loaded into curr_tc only if the curr_tc is 0 and the dma ack is 1. 00000
dma S3C2440a risc microprocessor 8- 12 dma status (dstat) register register address r/w description reset value dstat0 0x4b000014 r dma 0 count register 000000h dstat1 0x4b000054 r dma 1 count register 000000h dstat2 0x4b000094 r dma 2 count register 000000h dstat3 0x4b0000d4 r dma 3 count register 000000h dstatn bit description initial state stat [21:20] status of this dma controller. 00: indicates that dma controller is ready for another dma request. 01: indicates that dma controller is busy for transfers. 00b curr_tc [19:0] current value of transfer count. note that transfer count is initially set to the value of dconn[19:0] register and decreased by one at the end of every atomic transfer. 00000h
S3C2440a risc microprocessor dma 8- 13 dma current source (dcsrc) register register address r/w description reset value dcsrc0 0x4b000018 r dma 0 current source register 0x00000000 dcsrc1 0x4b000058 r dma 1 current source register 0x00000000 dcsrc2 0x4b000098 r dma 2 current source register 0x00000000 dcsrc3 0x4b0000d8 r dma 3 current source register 0x00000000 dcsrcn bit description initial state curr_src [30:0] current source address for dman 0x00000000 current destination (dcdst) register register address r/w description reset value dcdst0 0x4b00001c r dma 0 current destination register 0x00000000 dcdst1 0x4b00005c r dma 1 current destination register 0x00000000 dcdst2 0x4b00009c r dma 2 current destination register 0x00000000 dcdst3 0x4b0000dc r dma 3 current destination register 0x00000000 dcdstn bit description initial state curr_dst [30:0] current destination address for dman 0x00000000
dma S3C2440a risc microprocessor 8- 14 dma mask trigger (dmasktrig) register register address r/w description reset value dmasktrig0 0x4b000020 r/w dma 0 mask trigger register 000 dmasktrig1 0x4b000060 r/w dma 1 mask trigger register 000 dmasktrig2 0x4b0000a0 r/w dma 2 mask trigger register 000 dmasktrig3 0x4b0000e0 r/w dma 3 mask trigger register 000 dmasktrign bit description initial state stop [2] stop the dma operation. 1: dma stops as soon as the current atomic transfer ends. if there is no current running atomic transfer, dma stops immediately. the curr_tc, curr_src, and curr_dst will be 0. note: due to possible current atomic transfer, ?stop? operation may take several cycles. the finish of the operation (i.e. actual stop time) can be detected as soon as the channel on/off bit (dmasktrign[1]) is set to off. this stop is ?actual stop?. 0 on_off [1] dma channel on/off bit. 0: dma channel is turned off. (dma request to this channel is ignored.) 1: dma channel is turned on and the dma request is handled. this bit is automatically set to off if we set the dconn[22] bit to ?no auto reload? and/or stop bit of dmasktrign to ?stop?. note that when dcon[22] bit is "no auto reload", this bit becomes 0 when curr_tc reaches 0. if the stop bit is 1, this bit becomes 0 as soon as the current atomic transfer is completed. note: this bit should not be changed manually during dma operations (i.e. this has to be changed only by using dcon[22] or stop bit). 0 sw_trig [0] trigger the dma channel in s/w request mode. 1: it requests a dma operation to this controller. note that this trigger gets effective after s/w request mode has to be selected (dconn[23]) and channel on_off bit has to be set to 1 (channel on). when dma operation starts, this bit is cleared automatically. 0 note: you are allowed to change the values of disrc register, didst registers, and tc field of dcon register. those changes take effect only after the finish of current transfer (i.e. when curr_tc becomes 0). on the other hand, any change made to other reg isters and/or fields takes immediate effect. therefore, be careful in changing those registers and fields.
S3C2440a risc microprocessor i/o ports 9- 1 9 i/o ports overview S3C2440a has 130 multi-functional input/output port pins and there are eight ports as shown below: ? port a(gpa): 25-output port ? port b(gpb): 11-input/out port ? port c(gpc): 16-input/output port ? port d(gpd): 16-input/output port ? port e(gpe): 16-input/output port ? port f(gpf): 8-input/output port ? port g(gpg): 16-input/output port ? port h(gph): 9-input/output port ? port j(gpj): 13-input/output port each port can be easily configured by software to meet various system configurations and design requirements. you have to define which function of each pin is used before starting the main program. if a pin is not used for multiplexed functions, the pin can be configured as i/o ports. initial pin states are configured seamlessly to avoid problems.
i/o ports S3C2440a risc microprocessor 9- 2 table 9-1. S3C2440a port configuration (sheet 1 of 5) port a selectable pin functions gpa22 output only nfce ? ? gpa21 output only nrstout ? ? gpa20 output only nfre ? ? gpa19 output only nfwe ? ? gpa18 output only ale ? ? gpa17 output only cle ? ? gpa16 output only ngcs5 ? ? gpa15 output only ngcs4 ? ? gpa14 output only ngcs3 ? ? gpa13 output only ngcs2 ? ? gpa12 output only ngcs1 ? ? gpa11 output only addr26 ? ? gpa10 output only addr25 ? ? gpa9 output only addr24 ? ? gpa8 output only addr23 ? ? gpa7 output only addr22 ? ? gpa6 output only addr21 ? ? gpa5 output only addr20 ? ? gpa4 output only addr19 ? ? gpa3 output only addr18 ? ? gpa2 output only addr17 ? ? gpa1 output only addr16 ? ? gpa0 output only addr0 ? ?
S3C2440a risc microprocessor i/o ports 9- 3 table 9-1. S3C2440a port configuration (sheet 2 of 5) (continued) port b selectable pin functions gpb10 input/output nxdreq0 ? ? gpb9 input/output nxdack0 ? ? gpb8 input/output nxdreq1 ? ? gpb7 input/output nxdack1 ? ? gpb6 input/output nxbreq ? ? gpb5 input/output nxback ? ? gpb4 input/output tclk0 ? ? gpb3 input/output tout3 ? ? gpb2 input/output tout2 ? ? gpb1 input/output tout1 ? ? gpb0 input/output tout0 ? ? port c selectable pin functions gpc15 input/output vd7 ? ? gpc14 input/output vd6 ? ? gpc13 input/output vd5 ? ? gpc12 input/output vd4 ? ? gpc11 input/output vd3 ? ? gpc10 input/output vd2 ? ? gpc9 input/output vd1 ? ? gpc8 input/output vd0 ? ? gpc7 input/output lcd_lpcrevb ? ? gpc6 input/output lcd_lpcrev ? ? gpc5 input/output lcd_lpcoe ? ? gpc4 input/output vm ? ? gpc3 input/output vframe ? ? gpc2 input/output vline ? ? gpc1 input/output vclk ? ? gpc0 input/output lend ? ?
i/o ports S3C2440a risc microprocessor 9- 4 table 9-1. S3C2440a port configuration (sheet 3 of 5) (continued) port d selectable pin functions gpd15 input/output vd23 nss0 ? gpd14 input/output vd22 nss1 ? gpd13 input/output vd21 ? ? gpd12 input/output vd20 ? ? gpd11 input/output vd19 ? ? gpd10 input/output vd18 spiclk1 ? gpd9 input/output vd17 spimosi1 ? gpd8 input/output vd16 spimiso1 ? gpd7 input/output vd15 ? ? gpd6 input/output vd14 ? ? gpd5 input/output vd13 ? ? gpd4 input/output vd12 ? ? gpd3 input/output vd11 ? ? gpd2 input/output vd10 ? ? gpd1 input/output vd9 ? ? gpd0 input/output vd8 ? ? port e selectable pin functions gpe15 input/output iicsda ? ? gpe14 input/output iicscl ? ? gpe13 input/output spiclk0 ? ? gpe12 input/output spimosi0 ? ? gpe11 input/output spimiso0 ? ? gpe10 input/output sddat3 ? ? gpe9 input/output sddat2 ? ? gpe8 input/output sddat1 ? ? gpe7 input/output sddat0 ? ? gpe6 input/output sdcmd ? ? gpe5 input/output sdclk ? ? gpe4 input/output i2ssdo ac_sdata_out ? gpe3 input/output i2ssdi ac_sdata_in ? gpe2 input/output cdclk ac_nreset ? gpe1 input/output i2ssclk ac_bit_clk ? gpe0 input/output i2slrck ac_sync ?
S3C2440a risc microprocessor i/o ports 9- 5 table 9-1. S3C2440a port configuration (sheet 4 of 5) (continued) port f selectable pin functions gpf7 input/output eint7 ? ? gpf6 input/output eint6 ? ? gpf5 input/output eint5 ? ? gpf4 input/output eint4 ? ? gpf3 input/output eint3 ? ? gpf2 input/output eint2 gpf1 input/output eint1 gpf0 input/output eint0 port g selectable pin functions gpg15 input/output eint23 ? ? gpg14 input/output eint22 ? ? gpg13 input/output eint21 ? ? gpg12 input/output eint20 ? ? gpg11 input/output eint19 tclk1 ? gpg10 input/output eint18 ncts1 ? gpg9 input/output eint17 nrts1 ? gpg8 input/output eint16 ? ? gpg7 input/output eint15 spiclk1 ? gpg6 input/output eint14 spimosi1 ? gpg5 input/output eint13 spimiso1 ? gpg4 input/output eint12 lcd_pwren ? gpg3 input/output eint11 nss1 ? gpg2 input/output eint10 nss0 ? gpg1 input/output eint9 ? ? gpg0 input/output eint8 ? ?
i/o ports S3C2440a risc microprocessor 9- 6 table 9-1. S3C2440a port configuration (sheet 5 of 5) (continued) port h selectable pin functions gph10 input/output clkout1 ? ? gph9 input/output clkout0 ? ? gph8 input/output uextclk ? ? gph7 input/output rxd2 ncts1 ? gph6 input/output txd2 nrts1 ? gph5 input/output rxd1 ? ? gph4 input/output txd1 ? ? gph3 input/output rxd0 ? ? gph2 input/output txd0 ? ? gph1 input/output nrts0 ? ? gph0 input/output ncts0 ? ? port j selectable pin functions gpj12 input/output camreset ? ? gpj11 input/output camclkout ? ? gpj10 input/output camhref ? ? gpj9 input/output camvsync ? ? gpj8 input/output campclk ? ? gpj7 input/output camdata7 ? ? gpj6 input/output camdata6 ? ? gpj5 input/output camdata5 ? ? gpj4 input/output camdata4 ? ? gpj3 input/output camdata3 ? ? gpj2 input/output camdata2 ? ? gpj1 input/output camdata1 ? ? gpj0 input/output camdata0 ? ?
S3C2440a risc microprocessor i/o ports 9- 7 port control descriptions port configuration register (gpacon-gpjcon) in S3C2440a, most of the pins are multiplexed pins. so, it is determined which function is selected for each pins. the pncon(port control register) determines which function is used for each pin. if pe0 ? pe7 is used for the wakeup signal in power down mode, these ports must be configured in interrupt mode. port data register (gpadat-gpjdat) if ports are configured as output ports, data can be written to the corresponding bit of pndat. if ports are configured as input ports, the data can be read from the corresponding bit of pndat. port pull-up register (gpbup-gpjup) the port pull-up register controls the pull-up resister enable/disable of each port group. when the corresponding bit is 0, the pull-up resister of the pin is enabled. when 1, the pull-up resister is disabled. if the port pull-up register is enabled then the pull-up resisters work without pin?s functional setting(input, output, datan, eintn and etc) miscellaneous control register this register controls data port pull-up resister in sleep mode, usb pad, and clkout selection. external interrupt control register the 24 external interrupts are requested by various signaling methods. the extint register configures the signaling method among the low level trigger, high level trigger, falling edge trigger, rising edge trigger, and both edge trigger for the external interrupt request because each external interrupt pin has a digital filter, the interrupt controller can recognize the request signal that is longer than 3 clocks. eint[15:0] are used for wakeup sources.
i/o ports S3C2440a risc microprocessor 9- 8 i/o port control register port a control registers (gpacon, gpadat) register address r/w description reset value gpacon 0x56000000 r/w configures the pins of port a 0xffffff gpadat 0x56000004 r/w the data register for port a undef. reserved 0x56000008 ? reserved undef reserved 0x5600000c ? reserved undef gpacon bit description gpa24 [24] reserved gpa23 [23] reserved gpa22 [22] 0 = output 1 = nfce gpa21 [21] 0 = output 1 = nrstout gpa20 [20] 0 = output 1 = nfre gpa19 [19] 0 = output 1 = nfwe gpa18 [18] 0 = output 1 = ale gpa17 [17] 0 = output 1 = cle gpa16 [16] 0 = output 1 = ngcs[5] gpa15 [15] 0 = output 1 = ngcs[4] gpa14 [14] 0 = output 1 = ngcs[3] gpa13 [13] 0 = output 1 = ngcs[2] gpa12 [12] 0 = output 1 = ngcs[1] gpa11 [11] 0 = output 1 = addr26 gpa10 [10] 0 = output 1 = addr25 gpa9 [9] 0 = output 1 = addr24 gpa8 [8] 0 = output 1 = addr23 gpa7 [7] 0 = output 1 = addr22 gpa6 [6] 0 = output 1 = addr21 gpa5 [5] 0 = output 1 = addr20 gpa4 [4] 0 = output 1 = addr19 gpa3 [3] 0 = output 1 = addr18 gpa2 [2] 0 = output 1 = addr17 gpa1 [1] 0 = output 1 = addr16 gpa0 [0] 0 = output 1 = addr0 note: the gpa21 signal level depends on vddop, the other pads (gpa0~20, gpa22~24) are all on vddmop.
S3C2440a risc microprocessor i/o ports 9- 9
i/o ports S3C2440a risc microprocessor 9- 10 port a control registers (gpacon, gpadat) ( continued ) g padat bit description gpa[24:0] [24:0] when the port is configured as output port, the pin state is the same as the corresponding bit. when the port is configured as functional pin, the undefined value will be read. note: nrstout = nreset & nwdtrst & sw_reset
S3C2440a risc microprocessor i/o ports 9- 11 port b control registers (gpbcon, gpbdat, gpbup) register address r/w description reset value gpbcon 0x56000010 r/w configures the pins of port b 0x0 gpbdat 0x56000014 r/w the data register for port b undef. gpbup 0x56000018 r/w pull-up disable register for port b 0x0 reserved 0x5600001c pbcon bit description gpb10 [21:20] 00 = input 01 = output 10 = nxdreq0 11 = reserved gpb9 [19:18] 00 = input 01 = output 10 = nxdack0 11 = reserved gpb8 [17:16] 00 = input 01 = output 10 = nxdreq1 11 = reserved gpb7 [15:14] 00 = input 01 = output 10 = nxdack1 11 = reserved gpb6 [13:12] 00 = input 01 = output 10 = nxbreq 11 = reserved gpb5 [11:10] 00 = input 01 = output 10 = nxback 11 = reserved gpb4 [9:8] 00 = input 01 = output 10 = tclk [0] 11 = reserved gpb3 [7:6] 00 = input 01 = output 10 = tout3 11 = reserved gpb2 [5:4] 00 = input 01 = output 10 = tout2 11 = reserved] gpb1 [3:2] 00 = input 01 = output 10 = tout1 11 = reserved gpb0 [1:0] 00 = input 01 = output 10 = tout0 11 = reserved g pbdat bit description gpb[10:0] [10:0] when the port is configured as input port, the corresponding bit is the pin state. when the port is configured as output port, the pin state is the same as the corresponding bit. when the port is configured as functional pin, the undefined value will be read. gpbup bit description gpb[10:0] [10:0] 0: the pull up function attached to the corresponding port pin is enabled. 1: the pull up function is disabled.
i/o ports S3C2440a risc microprocessor 9- 12 port c control registers (gpccon, gpcdat, gpcup) register address r/w description reset value gpccon 0x56000020 r/w configures the pins of port c 0x0 gpcdat 0x56000024 r/w the data register for port c undef. gpcup 0x56000028 r/w pull-up disable register for port c 0x0 reserved 0x5600002c ? ? ? gpccon bit description gpc15 [31:30] 00 = input 01 = output 10 = vd[7] 11 = reserved gpc14 [29:28] 00 = input 01 = output 10 = vd[6] 11 = reserved gpc13 [27:26] 00 = input 01 = output 10 = vd[5] 11 = reserved gpc12 [25:24] 00 = input 01 = output 10 = vd[4] 11 = reserved gpc11 [23:22] 00 = input 01 = output 10 = vd[3] 11 = reserved gpc10 [21:20] 00 = input 01 = output 10 = vd[2] 11 = reserved gpc9 [19:18] 00 = input 01 = output 10 = vd[1] 11 = reserved gpc8 [17:16] 00 = input 01 = output 10 = vd[0] 11 = reserved gpc7 [15:14] 00 = input 01 = output 10 = lcd_lpcrevb 11 = reserved gpc6 [13:12] 00 = input 01 = output 10 = lcd_lpcrev 11 = reserved gpc5 [11:10] 00 = input 01 = output 10 = lcd_lpcoe 11 = res erved gpc4 [9:8] 00 = input 01 = output 10 = vm 11 = i2ssdi gpc3 [7:6] 00 = input 01 = output 10 = vframe 11 = reserved gpc2 [5:4] 00 = input 01 = output 10 = vline 11 = reserved gpc1 [3:2] 00 = input 01 = output 10 = vclk 11 = reserved gpc0 [1:0] 00 = input 01 = output 10 = lend 11 = reserved
S3C2440a risc microprocessor i/o ports 9- 13 port c control registers (gpccon, gpcdat, gpcup) ( continued ) g pcdat bit description gpc[15:0] [15:0] when the port is configured as input port, the corresponding bit is the pin state. when the port is configured as output port, the pin state is the same as the corresponding bit. when the port is configured as functional pin, the undefined value will be read. gpcup bit description gpc[15:0] [15:0] 0: the pull up function attached to the corresponding port pin is enabled. 1: the pull up function is disabled.
i/o ports S3C2440a risc microprocessor 9- 14 port d control registers (gpdcon, gpddat, gpdup) register address r/w description reset value gpdcon 0x56000030 r/w configures the pins of port d 0x0 gpddat 0x56000034 r/w the data register for port d undef. gpdup 0x56000038 r/w pull-up disable register for port d 0xf000 reserved 0x5600003c ? ? ? gpdcon bit description gpd15 [31:30] 00 = input 01 = output 10 = vd[23] 11 = nss0 gpd14 [29:28] 00 = input 01 = output 10 = vd[22] 11 = nss1 gpd13 [27:26] 00 = input 01 = output 10 = vd[21] 11 = reserved gpd12 [25:24] 00 = input 01 = output 10 = vd[20] 11 = reserved gpd11 [23:22] 00 = input 01 = output 10 = vd[19] 11 = reserved gpd10 [21:20] 00 = input 01 = output 10 = vd[18] 11 = spiclk1 gpd9 [19:18] 00 = input 01 = output 10 = vd[17] 11 = spimosi1 gpd8 [17:16] 00 = input 01 = output 10 = vd[16] 11 = spimiso1 gpd7 [15:14] 00 = input 01 = output 10 = vd[15] 11 = reserved gpd6 [13:12] 00 = input 01 = output 10 = vd[14] 11 = reserved gpd5 [11:10] 00 = input 01 = output 10 = vd[13] 11 = reserved gpd4 [9:8] 00 = input 01 = output 10 = vd[12] 11 = reserved gpd3 [7:6] 00 = input 01 = output 10 = vd[11] 11 = reserved gpd2 [5:4] 00 = input 01 = output 10 = vd[10] 11 = reserved gpd1 [3:2] 00 = input 01 = output 10 = vd[9] 11 = reserved gpd0 [1:0] 00 = input 01 = output 10 = vd[8] 11 = reserved
S3C2440a risc microprocessor i/o ports 9- 15 port d control registers (gpdcon, gpddat, gpdup) ( continued ) g pddat bit description gpd[15:0] [15:0] when the port is configured as input port, the corresponding bit is the pin state. when the port is configured as output port, the pin state is the same as the corresponding bit. when the port is configured as functional pin, the undefined value will be read. gpdup bit description gpd[15:0] [15:0] 0: the pull up function attached to the corresponding port pin is enabled. 1: the pull up function is disabled.
i/o ports S3C2440a risc microprocessor 9- 16 port e control registers (gpecon, gpedat, gpeup) register address r/w description reset value gpecon 0x56000040 r/w configures the pins of port e 0x0 gpedat 0x56000044 r/w the data register for port e undef. gpeup 0x56000048 r/w pull-up disable register for port e 0x0000 reserved 0x5600004c ? ? ? gpecon bit description gpe15 [31:30] 00 = input 01 = output 10 = iicsda 11 = reserved this pad is open-drain, there is no pull-up option. gpe14 [29:28] 00 = input 01 = output 10 = iicscl 11 = reserved this pad is open-drain, there is no pull-up option. gpe13 [27:26] 00 = input 01 = output 10 = spiclk0 11 = reserved gpe12 [25:24] 00 = input 01 = output 10 = spimosi0 11 = reserved gpe11 [23:22] 00 = input 01 = output 10 = spimiso0 11 = reserved gpe10 [21:20] 00 = input 01 = output 10 = sddat3 11 = reserved gpe9 [19:18] 00 = input 01 = output 10 = sddat2 11 = reserved gpe8 [17:16] 00 = input 01 = output 10 = sddat1 11 = reserved gpe7 [15:14] 00 = input 01 = output 10 = sddat0 11 = reserved gpe6 [13:12] 00 = input 01 = output 10 = sdcmd 11 = reserved gpe5 [11:10] 00 = input 01 = output 10 = sdclk 11 = reserved gpe4 [9:8] 00 = input 01 = output 10 = i2sdo 11 = ac_sdata_out gpe3 [7:6] 00 = input 01 = output 10 = i2sdi 11 = ac_sdata_in gpe2 [5:4] 00 = input 01 = output 10 = cdclk 11 = ac_nreset gpe1 [3:2] 00 = input 01 = output 10 = i2ssclk 11 = ac_bit_clk gpe0 [1:0] 00 = input 01 = output 10 = i2slrck 11 = ac_sync
S3C2440a risc microprocessor i/o ports 9- 17 port e control registers (gpecon, gpedat, gpeup) ( continued ) gpedat bit description gpe[15:0] [15:0] when the port is configured as an input port, the corresponding bit is the pin state. when the port is configured as an output port, the pin state is the same as the corresponding bit. when the port is configured as a functional pin, the undefined value will be read. gpe up bit description gpe[13:0] [13:0] 0: the pull up function attached to the corresponding port pin is enabled. 1: the pull up function is disabled.
i/o ports S3C2440a risc microprocessor 9- 18 port f control registers (gpfcon, gpfdat) if gpf0?gpf7 will be used for wake-up signals at power down mode, the ports will be set in interrupt mode. register address r/w description reset value gpfcon 0x56000050 r/w configures the pins of port f 0x0 gpfdat 0x56000054 r/w the data register for port f undef. gpfup 0x56000058 r/w pull-up disable register for port f 0x000 reserved 0x5600005c ? ? ? gpfcon bit description gpf7 [15:14] 00 = input 01 = output 10 = eint[7] 11 = reserved gpf6 [13:12] 00 = input 01 = output 10 = eint[6] 11 = reserved gpf5 [11:10] 00 = input 01 = output 10 = eint[5] 11 = reserved gpf4 [9:8] 00 = input 01 = output 10 = eint[4] 11 = reserved gpf3 [7:6] 00 = input 01 = output 10 = eint[3] 11 = reserved gpf2 [5:4] 00 = input 01 = output 10 = eint2] 11 = reserved gpf1 [3:2] 00 = input 01 = output 10 = eint[1] 11 = reserved gpf0 [1:0] 00 = input 01 = output 10 = eint[0] 11 = reserved gpfdat bit description gpf[7:0] [7:0] when the port is configured as an input port, the corresponding bit is the pin state. when the port is configured as an output port, the pin state is the same as the corresponding bit. when the port is configured as functional pin, the undefined value will be read. gpfup bit description gpf[7:0] [7:0] 0: the pull up function attached to the corresponding port pin is enabled. 1: the pull up function is disabled.
S3C2440a risc microprocessor i/o ports 9- 19 port g control registers (gpgcon, gpgdat) if gpg0?gpg7 will be used for wake-up signals at sleep mode, the ports will be set in interrupt mode. register address r/w description reset value gpgcon 0x56000060 r/w configures the pins of port g 0x0 gpgdat 0x56000064 r/w the data register for port g undef. gpgup 0x56000068 r/w pull-up disable register for port g 0xfc00 gpgcon bit description gpg15* [31:30] 00 = input 01 = output 10 = eint[23] 11 = reserved gpg14* [29:28] 00 = input 01 = output 10 = eint[22] 11 = reserved gpg13* [27:26] 00 = input 01 = output 10 = eint[21] 11 = reserved gpg12 [25:24] 00 = input 01 = output 10 = eint[20] 11 = reserved gpg11 [23:22] 00 = input 01 = output 10 = eint[19] 11 = tclk[1] gpg10 [21:20] 00 = input 01 = output 10 = eint[18] 11 = ncts1 gpg9 [19:18] 00 = input 01 = output 10 = eint[17] 11 = nrts1 gpg8 [17:16] 00 = input 01 = output 10 = eint[16] 11 = reserved gpg7 [15:14] 00 = input 01 = output 10 = eint[15] 11 = spiclk1 gpg6 [13:12] 00 = input 01 = output 10 = eint[14] 11 = spimosi1 gpg5 [11:10] 00 = input 01 = output 10 = eint[13] 11 = spimiso1 gpg4 [9:8] 00 = input 01 = output 10 = eint[12] 11 = lcd_pwrdn gpg3 [7:6] 00 = input 01 = output 10 = eint[11] 11 = nss1 gpg2 [5:4] 00 = input 01 = output 10 = eint[10] 11 = nss0 gpg1 [3:2] 00 = input 01 = output 10 = eint[9] 11 = reserved gpg0 [1:0] 00 = input 01 = output 10 = eint[8] 11 = reserved note: gpg[15:13] must be selected as input in nand boot mode.
i/o ports S3C2440a risc microprocessor 9- 20 port g control registers (gpgcon, gpgdat) ( continued ) gpgdat bit description gpg[15:0] [15:0] when the port is configured as an input port, the corresponding bit is the pin state. when the port is configured as an output port, the pin state is the same as the corresponding bit. when the port is configured as functional pin, the undefined value will be read. gpgup bit description gpg[15:0] [15:0] 0: the pull up function attached to the corresponding port pin is enabled. 1: the pull up function is disabled.
S3C2440a risc microprocessor i/o ports 9- 21 port h control registers (gphcon, gphdat) register address r/w description reset value gphcon 0x56000070 r/w configures the pins of port h 0x0 gphdat 0x56000074 r/w the data register for port h undef. gphup 0x56000078 r/w pull-up disable register for port h 0x000 reserved 0x5600007c ? ? ? gphcon bit description gph10 [21:20] 00 = input 01 = output 10 = clkout1 11 = reserved gph9 [19:18] 00 = input 01 = output 10 = clkout0 11 = reserved gph8 [17:16] 00 = input 01 = output 10 = uextclk 11 = reserved gph7 [15:14] 00 = input 01 = output 10 = rxd[2] 11 = ncts1 gph6 [13:12] 00 = input 01 = output 10 = txd[2] 11 = nrts1 gph5 [11:10] 00 = input 01 = output 10 = rxd[1] 11 = reserved gph4 [9:8] 00 = input 01 = output 10 = txd[1] 11 = reserved gph3 [7:6] 00 = input 01 = output 10 = rxd[0] 11 = reserved gph2 [5:4] 00 = input 01 = output 10 = txd[0] 11 = reserved gph1 [3:2] 00 = input 01 = output 10 = nrts0 11 = reserved gph0 [1:0] 00 = input 01 = output 10 = ncts0 11 = reserved gphdat bit description gph[10:0] [10:0] when the port is configured as an input port, the corresponding bit is the pin state. when the port is configured as an output port, the pin state is the same as the corresponding bit. when the port is configured as functional pin, the undefined value will be read. gphup bit description gph[10:0] [10:0] 0: the pull up function attached to the corresponding port pin is enabled. 1: the pull up function is disabled.
i/o ports S3C2440a risc microprocessor 9- 22 port j control registers (gpjcon, gpjdat) register address r/w description reset value gpjcon 0x560000d0 r/w configures the pins of port j 0x0 gpjdat 0x560000d4 r/w the data register for port j undef. gpjup 0x560000d8 r/w pull-up disable register for port j 0x0000 reserved 0x560000dc ? ? ? gpjcon bit description gpj12 [25:24] 00 = input 01 = output 10 = camreset 11 = reserved gpj11 [23:22] 00 = input 01 = output 10 = camclkout 11 = reserved gpj10 [21:20] 00 = input 01 = output 10 = camhref 11 = reserved gpj9 [19:18] 00 = input 01 = output 10 = camvsync 11 = reserved gpj8 [17:16] 00 = input 01 = output 10 = campclk 11 = reserved gpj7 [15:14] 00 = input 01 = output 10 = camdata[7] 11 = reserved gpj6 [13:12] 00 = input 01 = output 10 = camdata[6] 11 = reserved gpj5 [11:10] 00 = input 01 = output 10 = camdata[5] 11 = reserved gpj4 [9:8] 00 = input 01 = output 10 = camdata[4] 11 = reserved gpj3 [7:6] 00 = input 01 = output 10 = camdata[3] 11 = reserved gpj2 [5:4] 00 = input 01 = output 10 = camdata[2] 11 = reserved gpj1 [3:2] 00 = input 01 = output 10 = camdata[1] 11 = reserved gpj0 [1:0] 00 = input 01 = output 10 = camdata[0] 11 = reserved
S3C2440a risc microprocessor i/o ports 9- 23 port j control registers (gpjcon, gpjdat) ( continued ) gpjdat bit description gpj15:0] [12:0] when the port is configured as an input port, the corresponding bit is the pin state. when the port is configured as an output port, the pin state is the same as the corresponding bit. when the port is configured as functional pin, the undefined value will be read. gpjup bit description gpj[12:0] [12:0] 0: the pull up function attached to the corresponding port pin is enabled. 1: the pull up function is disabled.
i/o ports S3C2440a risc microprocessor 9- 24 miscellaneous control register (misccr) in sleep mode, the data bus(d[31:0] or d[15:0] can be set as hi-z and output ?0? state. but, because of the characteristics of io pad, the data bus pull-up resisters have to be turned on or off to reduce the power consumption. d[31:0] pin pull-up resisters can be controlled by misccr register. pads related usb are controlled by this register for usb host, or for usb device. register address r/w description reset value misccr 0x56000080 r/w miscellaneous control register 0x10020 misccr bit description reset value reserved [24] reserve to 0. 0 reserved [23] reserve to 0. 0 batt_func [22:20] battery fault function selection. 0xx: in nbatt_flt=0, the system will be in reset status. after reset, change this bit to other values, this bit is only for preventing from booting in battery fault status. 10x: in sleep mode status, when nbatt_flt=0, the system will wake-up. in normal mode, when nbatt_flt=0, the battery fault interrupt will occur. 110: in sleep mode status, during nbatt_flt=0, the system will ignore all the wake-up events(the system will not wake-up by wake-up source). in normal mode, nbatt_flt signal cannot affect the system. 111: nbatt_flt function disable. 000 offrefresh [19] 0: self refresh retain disable 1: self refresh retain enable when 1, after wake-up from sleep, the self-refresh will be retained. 0 nen_sclk1 [18] sclk1 output enable 0: sclk1 = sclk 1: sclk1 = 0 0 nen_sclk0 [17] sclk0 output enable 0: sclk0 = sclk 1: sclk 0 = 0 0 nrstcon [16] nrstout signal manual control 0: nrstout signal level will be low (?0?) 1: nrstout signal level will be high (?1?) 1 reserved [15:14] ? 00 sel_suspnd1 [13] usb port 1 suspend mode 0 = normal mode 1 = suspend mode 0 sel_suspnd0 [12] usb port 0 suspend mode 0 = normal mode 1 = suspend mode 0
S3C2440a risc microprocessor i/o ports 9- 25 miscellaneous control register (misccr) ( continued ) misccr bit description reset value clksel1 (note) [10:8] select source clock with clkout1 pad 000 = mpll output 001 = upll output 010 = rtc clock output 011 = hclk 100 = pclk 101 = dclk1 11x = reserved 000 reserved [7] ? 0 clksel0 (note) [6:4] select source clock with clkout0 pad 000 = mpll input clock(xtal) 001 = upll output 010 = fclk 011 = hclk 100 = pclk 101 = dclk0 11x = reserved 010 sel_usbpad [3] usb1 host/device select register. 0 = use usb1 as device 1 = use usb1 as host 0 reserved [2] reserved 0 spucr1 [1] 0 = data[31:16] port pull-up resister is enabled 1 = data[31:16] port pull-up resister is disabled 0 spucr0 [0] 0 = data[15:0] port pull-up resister is enabled 1 = data[15:0] port pull-up resister is disabled 0 note: we recommend not to use this ouput pad to other device?s pll clock source.
i/o ports S3C2440a risc microprocessor 9- 26 dclk control registers (dclkcon) register address r/w description reset value dclkcon 0x56000084 r/w dclk0/1 control register 0x0 dclkcon bit description dclk1cmp [27:24] dclk1 compare value clock toggle value. ( < dclk1div) if the dclk1cmp is n, low level duration is( n + 1), high level duration is((dclk1div + 1) ?( n +1)) dclk1div [23:20] dclk1 divide value dclk1 frequency = source clock /( dclk1div + 1) dclk1selck [17] select dclk1 source clock 0 = pclk 1 = uclk( usb) dclk1en [16] dclk1 enable 0 = dclk1 disable 1 = dclk1 enable dclk0cmp [11:8] dclk0 compare value clock toggle value.( < dclk0div) if the dclk0cmp is n, low level duration is( n + 1), high level duration is((dclk0div + 1) ?( n +1)) dclk0div [7:4] dclk0 divide value. dclk0 frequency = source clock /( dclk0div + 1) dclk0selck [1] select dclk0 source clock 0 = pclk 1 = uclk( usb) dclk0en [0] dclk0 enable 0 = dclk0 disable 1 = dclk0 enable dclkndiv + 1 dclkncmp + 1
S3C2440a risc microprocessor i/o ports 9- 27 extint n ( external interrupt control register n ) the 8 external interrupts can be requested by various signaling methods. the extint register configures the signaling method between the level trigger and edge trigger for the external interrupt request, and also configures the signal polarity. to recognize the level interrupt, the valid logic level on extintn pin must be retained for 40ns at least because of the noise filter. register address r/w description reset value extint0 0x56000088 r/w external interrupt control register 0 0x000000 extint1 0x5600008c r/w external interrupt control register 1 0x000000 extint2 0x56000090 r/w external interrupt control register 2 0x000000 extint0 bit description eint7 [30:28] setting the signaling method of the eint7. 000 = low level 001 = high level 01x = falling edge triggered 10x = rising edge triggered 11x = both edge triggered eint6 [26:24] setting the signaling method of the eint6. 000 = low level 001 = high level 01x = falling edge triggered 10x = rising edge triggered 11x = both edge triggered eint5 [22:20] setting the signaling method of the eint5. 000 = low level 001 = high level 01x = falling edge triggered 10x = rising edge triggered 11x = both edge triggered eint4 [18:16] setting the signaling method of the eint4. 000 = low level 001 = high level 01x = falling edge triggered 10x = rising edge triggered 11x = both edge triggered eint3 [14:12] setting the signaling method of the eint3. 000 = low level 001 = high level 01x = falling edge triggered 10x = rising edge triggered 11x = both edge triggered eint2 [10:8] setting the signaling method of the eint2. 000 = low level 001 = high level 01x = falling edge triggered 10x = rising edge triggered 11x = both edge triggered eint1 [6:4] setting the signaling method of the eint1. 000 = low level 001 = high level 01x = falling edge triggered 10x = rising edge triggered 11x = both edge triggered eint0 [2:0] setting the signaling method of the eint0. 000 = low level 001 = high level 01x = falling edge triggered 10x = rising edge triggered 11x = both edge triggered
i/o ports S3C2440a risc microprocessor 9- 28 extint n ( external interrupt control register n ) ( continued ) extint1 bit description flten15 [31] filter enable for eint15 0 = filter disable 1 = filter enable eint15 [30:28] setting the signaling method of the eint15. 000 = low level 001 = high level 01x = falling edge triggered 10x = rising edge triggered 11x = both edge triggered flten14 [27] filter enable for eint14 0 = filter disable 1 = filter enable eint14 [26:24] setting the signaling method of the eint14. 000 = low level 001 = high level 01x = falling edge triggered 10x = rising edge triggered 11x = both edge triggered flten13 [23] filter enable for eint13 0 = filter disable 1 = filter enable eint13 [22:20] setting the signaling method of the eint13. 000 = low level 001 = high level 01x = falling edge triggered 10x = rising edge triggered 11x = both edge triggered flten12 [19] filter enable for eint12 0 = filter disable 1 = filter enable eint12 [18:16] setting the signaling method of the eint12. 000 = low level 001 = high level 01x = falling edge triggered 10x = rising edge triggered 11x = both edge triggered flten11 [15] filter enable for eint11 0 = filter disable 1 = filter enable eint11 [14:12] setting the signaling method of the eint11. 000 = low level 001 = high level 01x = falling edge triggered 10x = rising edge triggered 11x = both edge triggered flten10 [11] filter enable for eint10 0 = filter disable 1 = filter enable eint10 [10:8] setting the signaling method of the eint10. 000 = low level 001 = high level 01x = falling edge triggered 10x = rising edge triggered 11x = both edge triggered flten9 [7] filter enable for eint9 0 = filter disable 1 = filter enable eint9 [6:4] setting the signaling method of the eint9. 000 = low level 001 = high level 01x = falling edge triggered 10x = rising edge triggered 11x = both edge triggered flten8 [3] filter enable for eint8 0 = filter disable 1 = filter enable eint8 [2:0] setting the signaling method of the eint8. 000 = low level 001 = high level 01x = falling edge triggered 10x = rising edge triggered 11x = both edge triggered
S3C2440a risc microprocessor i/o ports 9- 29 extint n ( external interrupt control register n ) ( continued ) extint2 bit description reset value flten23 [31] filter enable for eint23 0 = filter disable 1= filter enable 0 eint23 [30:28] setting the signaling method of the eint23. 000 = low level 001 = high level 01x = falling edge triggered 10x = rising edge triggered 11x = both edge triggered 000 flten22 [27] filter enable for eint22 0 = filter disable 1= filter enable 0 eint22 [26:24] setting the signaling method of the eint22. 000 = low level 001 = high level 01x = falling edge triggered 10x = rising edge triggered 11x = both edge triggered 000 flten21 [23] filter enable for eint21 0 = filter disable 1= filter enable 0 eint21 [22:20] setting the signaling method of the eint21. 000 = low level 001 = high level 01x = falling edge triggered 10x = rising edge triggered 11x = both edge triggered 000 flten20 [19] filter enable for eint20 0 = filter disable 1= filte r enable 0 eint20 [18:16] setting the signaling method of the eint20. 000 = low level 001 = high level 01x = falling edge triggered 10x = rising edge triggered 11x = both edge triggered 000 flten19 [15] filter enable for eint19 0 = filter disable 1= filter enable 0 eint19 [14:12] setting the signaling method of the eint19. 000 = low level 001 = high level 01x = falling edge triggered 10x = rising edge triggered 11x = both edge triggered 000 flten18 [11] filter enable for eint18 0 = filter disable 1= filter enable 0 eint18 [10:8] setting the signaling method of the eint18. 000 = low level 001 = high level 01x = falling edge triggered 10x = rising edge triggered 11x = both edge triggered 000
i/o ports S3C2440a risc microprocessor 9- 30 extint n ( external interrupt control register n ) ( continued ) extint2 bit description reset value flten17 [7] filter enable for eint17 0 = filter disable 1= filter enable 0 eint17 [6:4] setting the signaling method of the eint17. 000 = low level 001 = high level 01x = falling edge triggered 10x = rising edge triggered 11x = both edge triggered 000 flten16 [3] filter enable for eint16 0 = filter disable 1= filter enable 0 eint16 [2:0] setting the signaling method of the eint16. 000 = low level 001 = high level 01x = falling edge triggered 10x = rising edge triggered 11x = both edge triggered 000
S3C2440a risc microprocessor i/o ports 9- 31 eintflt n ( external interrupt filter register n ) to recognize the level interrupt, the valid logic level on extintn pin must be retained for 40ns at least because of the noise filter. register address r/w description reset value eintflt0 0x56000094 r/w reserved 0x000000 eintflt1 0x56000098 r/w reserved 0x000000 eintflt2 0x5600009c r/w external interrupt control register 2 0x000000 eintflt3 0x4c6000a0 r/w external interrupt control register 3 0x000000 eintflt2 bit description eintflt19 [30:24] filtering width of eint19 fltclk18 [23] filter clock of eint18 (configured by om) 0 = pclk 1= extclk/osc_clk eintflt18 [22:16] filtering width of eint18 fltclk17 [15] filter clock of eint17 (configured by om) 0 = pclk 1= extclk/osc_clk eintflt17 [14:8] filtering width of eint17 fltclk16 [7] filter clock of eint16 (configured by om) 0 = pclk 1= extclk/osc_clk eintflt16 [6:0] filtering width of eint16 eintflt3 bit description fltclk23 [31] filter clock of eint23 (configured by om) 0 = pclk 1= extclk/osc_clk eintflt23 [30:24] filtering width of eint23 fltclk22 [23] filter clock of eint22 (configured by om) 0 = pclk 1= extclk/osc_clk eintflt22 [22:16] filtering width of eint22 fltclk21 [15] filter clock of eint21(configured by om) 0 = pclk 1= extclk/osc_clk eintflt21 [14:8] filtering width of eint21 fltclk20 [7] filter clock of eint20 (configured by om) 0 = pclk 1= extclk/osc_clk eintflt20 [6:0] filtering width of eint20
i/o ports S3C2440a risc microprocessor 9- 32 eintmask ( external interrupt mask register ) register address r/w description reset value eintmask 0x560000a4 r/w external interrupt mask register 0x000fffff eintmask bit description eint23 [23] 0 = enable interrupt 1= masked eint22 [22] 0 = enable interrupt 1= masked eint21 [21] 0 = enable interrupt 1= masked eint20 [20] 0 = enable interrupt 1= masked eint19 [19] 0 = enable interrupt 1= masked eint18 [18] 0 = enable interrupt 1= masked eint17 [17] 0 = enable interrupt 1= masked eint16 [16] 0 = enable interrupt 1= masked eint15 [15] 0 = enable interrupt 1= masked eint14 [14] 0 = enable interrupt 1= masked eint13 [13] 0 = enable interrupt 1= masked eint12 [12] 0 = enable interrupt 1= masked eint11 [11] 0 = enable interrupt 1= masked eint10 [10] 0 = enable interrupt 1= masked eint9 [9] 0 = enable interrupt 1= masked eint8 [8] 0 = enable interrupt 1= masked eint7 [7] 0 = enable interrupt 1= masked eint6 [6] 0 = enable interrupt 1= masked eint5 [5] 0 = enable interrupt 1= masked eint4 [4] 0 = enable interrupt 1= masked reserved [3:0] reserved
S3C2440a risc microprocessor i/o ports 9- 33 eintpend ( external interrupt pending register ) register address r/w description reset value eintpend 0x560000a8 r/w external interrupt pending register 0x00 eintpend bit description reset value eint23 [23] it is cleard by writing ?1? 0 = not occur 1 = occur interrupt 0 eint22 [22] it is cleard by writing ?1? 0 = not occur 1 = occur interrupt 0 eint21 [21] it is cleard by writing ?1? 0 = not occur 1 = occur interrupt 0 eint20 [20] it is cleard by writing ?1? 0 = not occur 1 = occur interrupt 0 eint19 [19] it is cleard by writing ?1? 0 = not occur 1 = occur interrupt 0 eint18 [18] it is cleard by writing ?1? 0 = not occur 1 = occur interrupt 0 eint17 [17] it is cleard by writing ?1? 0 = not occur 1 = occur interrupt 0 eint16 [16] it is cleard by writing ?1? 0 = not occur 1 = occur interrupt 0 eint15 [15] it is cleard by writing ?1? 0 = not occur 1 = occur interrupt 0 eint14 [14] it is cleard by writing ?1? 0 = not occur 1 = occur interrupt 0 eint13 [13] it is cleard by writing ?1? 0 = not occur 1 = occur interrupt 0 eint12 [12] it is cleard by writing ?1? 0 = not occur 1 = occur interrupt 0 eint11 [11] it is cleard by writing ?1? 0 = not occur 1 = occur interrupt 0 eint10 [10] it is cleard by writing ?1? 0 = not occur 1 = occur interrupt 0 eint9 [9] it is cleard by writing ?1? 0 = not occur 1 = occur interrupt 0 eint8 [8] it is cleard by writing ?1? 0 = not occur 1 = occur interrupt 0 eint7 [7] it is cleard by writing ?1? 0 = not occur 1 = occur interrupt 0 eint6 [6] it is cleard by writing ?1? 0 = not occur 1 = occur interrupt 0 eint5 [5] it is cleard by writing ?1? 0 = not occur 1 = occur interrupt 0 eint4 [4] it is cleard by writing ?1? 0 = not occur 1 = occur interrupt 0 reserved [3:0] reserved 0000
i/o ports S3C2440a risc microprocessor 9- 34
S3C2440a risc microprocessor i/o ports 9- 35 gstatus n ( general status registers ) register address r/w description reset value gstatus0 0x560000ac r external pin status not define gstatus1 0x560000b0 r chip id 0x32440001 gstatus2 0x560000b4 r/w reset status 0x1 gstatus3 0x560000b8 r/w inform register 0x0 gstatus4 0x560000bc r/w inform register 0x0 gstatus0 bit description nwait [3] status of nwait pin ncon [2] status of ncon pin rnb [1] status of rnb pin batt_flt [0] status of batt_flt pin gstatus1 bit description chip id [0] id register = 0x32440001 gstatus2 bit description reserved [3] reserved wdtrst [2] boot is caused by watch dog reset cleared by writing ?1? sleeprst [1] boot is caused by wakeup reset in sleep mode cleared by writing ?1?. pwrst [0] boot is caused by power on reset cleared by writing ?1? gstatus3 bit description inform [31:0] inform register. this register is cleard by power on reset. otherwise, preserve data value. gstatus4 bit description inform [31:0] inform register. this register is cleard by power on reset. otherwise, preserve data value.
i/o ports S3C2440a risc microprocessor 9- 36 dsc n ( drive strength control ) control the memory i/o drive strength register address r/w description reset value dsc0 0x560000c4 r/w strength control register 0 0x0 dsc1 0x560000c8 r/w strength control register 1 0x0 dsc0 bit description reset value nen_dsc [31] enable drive strength control 0: enable 1: disable 0 reserved [30:10] ? 0 dsc_adr [9:8] address bus drive strength. 00: 12ma 10: 10ma 01: 8ma 11: 6ma 00 dsc_data3 [7:6] data[31:24] i/o drive strength. 00: 12ma 10: 10ma 01: 8ma 11: 6ma 00 dsc_data2 [5:4] data[23:16] i/o drive strength. 00: 12ma 10: 10ma 01: 8ma 11: 6ma 00 dsc_data1 [3:2] data[15:8] i/o drive strength. 00: 12ma 10: 10ma 01: 8ma 11: 6ma 00 dsc_data0 [1:0] data[7:0] i/o drive strength. 00: 12ma 10: 10ma 01: 8ma 11: 6ma 00
S3C2440a risc microprocessor i/o ports 9- 37 dsc n ( drive strength control ) dsc1 bit description reset value dsc_sck1 [29:28] sclk1 drive strength. 00: 12ma 10: 10ma 01: 8ma 11: 6ma 00 dsc_sck0 [27:26] sclk0 drive strength. 00: 12ma 10: 10ma 01: 8ma 11: 6ma 00 dsc_scke [25:24] scke drive strength. 00: 10ma 10: 8ma 01: 6ma 11: 4ma 00 dsc_sdr [23:22] nsras/nscas drive strength. 00: 10ma 10: 8ma 01: 6ma 11: 4ma 00 dsc_nfc [21:20] nand flash control drive strength (nfce, nfre, nfwe, cle, ale). 00: 10ma 10: 8ma 01: 6ma 11: 4ma 00 dsc_be [19:18] nbe[3:0] drive strength. 00: 10ma 10: 8ma 01: 6ma 11: 4ma 00 dsc_woe [17:16] nwe/noe drive strength. 00: 10ma 10: 8ma 01: 6ma 11: 4ma 00 dsc_cs7 [15:14] ngcs7 drive strength. 00: 10ma 10: 8ma 01: 6ma 11: 4ma 00 dsc_cs6 [13:12] ngcs6 drive strength. 00: 10ma 10: 8ma 01: 6ma 11: 4ma 00 dsc_cs5 [11:10] ngcs5 drive strength. 00: 10ma 10: 8ma 01: 6ma 11: 4ma 00 dsc_cs4 [9:8] ngcs4 drive strength. 00: 10ma 10: 8ma 01: 6ma 11: 4ma 00 dsc_cs3 [7:6] ngcs3 drive strength. 00: 10ma 10: 8ma 01: 6ma 11: 4ma 00 dsc_cs2 [5:4] ngcs2 drive strength. 00: 10ma 10: 8ma 01: 6ma 11: 4ma 00 dsc_cs1 [3:2] ngcs1 drive strength. 00: 10ma 10: 8ma 01: 6ma 11: 4ma 00 dsc_cs0 [1:0] ngcs0 drive strength. 00: 10ma 10: 8ma 01: 6ma 11: 4ma 00
i/o ports S3C2440a risc microprocessor 9- 38 mslcon ( memory sleep control register ) select memory interface status when in sleep mode. register address r/w description reset value mslcon 0x560000cc r/w memory sleep control register 0x0 mslcon bit description reset value psc_data [11] data[31:0] pin status in sleep mode. 0: hi-z 1: output ?0?. 0 psc_wait [10] nwait pin status in sleep mode. 0: input 1: output ?0? 0 psc_rnb [9] rnb pin status in sleep mode. 0: input 1: output ?0? 0 psc_nf [8] nand flash i/f pin status in sleep mode( nfce,nfre,nfwe,ale,cle). 0: inactive(nfce,nfre,nfwe,ale,cle = 11100) 1: hi-z 0 psc_sdr [7] nsras, nscas pin status in sleep mode. 0: inactive(?1?) 1: hi-z 0 psc_dqm [6] dqm[3:0]/nwe[3:0] pin status in sleep mode. 0: inactive 1: hi-z 0 psc_oe [5] noe pin status in sleep mode. 0: inactive(?1?) 1: hi-z 0 psc_we [4] nwe pin status in sleep mode. 0: inactive(?1?) 1: hi-z 0 psc_gcs0 [3] ngcs[0] pin status in sleep mode. 0: inactive(?1?) 1: hi-z 0 psc_gcs51 [2] ngcs[5:1] pin status in sleep mode. 0: inactive(?1?) 1: hi-z 0 psc_gcs6 [1] ngcs[6] pin status in sleep mode. 0: inactive(?1?) 1: hi-z 0 psc_gcs7 [0] ngcs[7] pin status in sleep mode. 0: inactive(?1?) 1: hi-z 0
S3C2440a risc microprocessor pwm timer 10- 1 10 pwm timer overview the S3C2440a has five 16-bit timers. timer 0, 1, 2, and 3 have pulse width modulation (pwm) function. timer 4 has an internal timer only with no output pins. the timer 0 has a dead-zone generator, which is used with a large current device. the timer 0 and 1 share an 8-bit prescaler, while the timer 2, 3 and 4 share other 8-bit prescaler. each timer has a clock divider, which generates 5 different divided signals (1/2, 1/4, 1/8, 1/16, and tclk). each timer block receives its own clock signals from the clock divider, which receives the clock from the corresponding 8-bit prescaler. the 8- bit prescaler is programmable and divides the pclk according to the loading value, which is stored in tcfg0 and tcfg1 registers. the timer count buffer register (tcntbn) has an initial value which is loaded into the down-counter when the timer is enabled. the timer compare buffer register (tcmpbn) has an initial value which is loaded into the compare register to be compared with the down-counter value. this double buffering feature of tcntbn and tcmpbn makes the timer generate a stable output when the frequency and duty ratio are changed. each timer has its own 16-bit down counter, which is driven by the timer clock. when the down counter reaches zero, the timer interrupt request is generated to inform the cpu that the timer operation has been completed. when the timer counter reaches zero, the value of corresponding tcntbn is automatically loaded into the down counter to continue the next operation. however, if the timer stops, for example, by clearing the timer enable bit of tconn during the timer running mode, the value of tcntbn will not be reloaded into the counter. the value of tcmpbn is used for pulse width modulation (pwm). the timer control logic changes the output level when the down-counter value matches the value of the compare register in the timer control logic. therefore, the compare register determines the turn-on time (or turn-off time) of a pwm output. feature ? five 16-bit timers ? two 8-bit prescalers & two 4-bit divider ? programmable duty control of output waveform (pwm) ? auto reload mode or one-shot pulse mode ? dead-zone generator
pwm timer S3C2440a risc microprocessor 10- 2 clock divider 5:1 mux dead zone generator tout0 tout1 tout2 control logic0 tcmpb0 tcntb0 control logic1 tcmpb1 tcntb1 5:1 mux clock divider 5:1 mux 5:1 mux control logic2 tcmpb2 tcntb2 tout3 control logic3 tcmpb3 tcntb3 no pin pclk 8-bit prescaler 8-bit prescaler dead zone dead zone tclk0 1/8 1/4 1/16 1/2 tclk1 1/8 1/4 1/16 1/2 5:1 mux control logic4 tcntb4 figure 10-1. 16-bit pwm timer block diagram
S3C2440a risc microprocessor pwm timer 10- 3 pwm timer operation prescaler & divider an 8-bit prescaler and a 4-bit divider make the following output frequencies: 4-bit divider settings minimum resolution (prescaler = 0) maximum resolution (prescaler = 255) maximum interval (tcntbn = 65535) 1/2 (pclk = 50 mhz) 0.0400 us (25.0000 mhz) 10.2400 us (97.6562 khz) 0.6710 sec 1/4 (pclk = 50 mhz) 0.0800 us (12.5000 mhz) 20.4800 us (48.8281 khz) 1.3421 sec 1/8 (pclk = 50 mhz) 0.1600 us ( 6.2500 mhz) 40.9601 us (24.4140 khz) 2.6843 sec 1/16 (pclk = 50 mhz) 0.3200 us ( 3.1250 mhz) 81.9188 us (12.2070 khz) 5.3686 sec basic timer operation tcmpn 1 0 tcntn 3 3 2 1 0 2 1 0 0 start bit=1 timer is started tcntn=tcmpn auto-reload tcntn=tcmpn timer is stopped toutn command status tcntbn=3 tcmpbn=1 manual update=1 auto-reload=1 tcntbn=2 tcmpbn=0 manual update=0 auto-reload=1 interrupt request auto-reload interrupt request figure 10-2. timer operations a timer (except the timer ch-5) has tcntbn, tcntn, tcmpbn and tcmpn. (tcntn and tcmpn are the names of the internal registers. the tcntn register can be read from the tcnton register) the tcntbn and the tcmpbn are loaded into the tcntn and the tcmpn when the timer reaches 0. when the tcntn reaches 0, an interrupt request will occur if the interrupt is enabled.
pwm timer S3C2440a risc microprocessor 10- 4 auto reload & double buffering S3C2440a pwm timers have a double buffering function, enabling the reload value changed for the next timer operation without stopping the current timer operation. so, although the new timer value is set, a current timer operation is completed successfully. the timer value can be written into timer count buffer register (tcntbn) and the current counter value of the timer can be read from timer count observation register (tcnton). if the tcntbn is read, the read value does not indicate the current state of the counter but the reload value for the next timer duration. the auto-reload operation copies the tcntbn into tcntn when the tcntn reaches 0. the value, written into the tcntbn, is loaded to the tcntn only when the tcntn reaches 0 and auto reload is enabled. if the tcntn becomes 0 and the auto reload bit is 0, the tcntn does not operate any further. write tcntbn = 100 write tcntbn = 200 start tcntbn = 150 auto-reload 150 100 100 200 interrupt write tcntbn = 100 write tcntbn = 200 start tcntbn = 150 auto-reload 150 100 100 200 interrupt figure 10-3. example of double buffering function
S3C2440a risc microprocessor pwm timer 10- 5 timer initialization using manual update bit and inverter bit an auto reload operation of the timer occurs when the down counter reaches 0. so, a starting value of the tcntn has to be defined by the user in advance. in this case, the starting value has to be loaded by the manual update bit. the following steps describe how to start a timer: 1) write the initial value into tcntbn and tcmpbn. 2) set the manual update bit of the corresponding timer. it is recommended that you configure the inverter on/off bit. (whether use inverter or not). 3) set start bit of the corresponding timer to start the timer (and clear the manual update bit). if the timer is stopped by force, the tcntn retains the counter value and is not reloaded from tcntbn. if a new value has to be set, perform manual update. note whenever tout inverter on/off bit is changed, the toutn logic value will also be changed whether the timer runs. therefore, it is desirable that the inverter on/off bit is configured with the manual update bit.
pwm timer S3C2440a risc microprocessor 10- 6 timer operation toutn 1 2 4 6 50 110 40 40 60 20 3 7 9 10 5 8 11 figure 10-4. example of a timer operation the above figure 10-4 shows the result of the following procedure: 1. enable the auto re-load function. set the tcntbn to 160 (50+110) and the tcmpbn to 110. set the manual update bit and configure the inverter bit (on/off). the manual update bit sets tcntn and tcmpn to the values of tcntbn and tcmpbn, respectively. and then, set the tcntbn and the tcmpbn to 80 (40+40) and 40, respectively, to determine the next reload value. 2. set the start bit, provided that manual_update is 0 and the inver ter is off and auto reload is on. the timer starts counting down after latency time within the timer resolution. 3. when the tcntn has the same value as that of the tcmpn, the logic level of the toutn is changed from low to high. 4. when the tcntn reaches 0, the interrupt request is generated and tcntbn value is loaded into a temporary register. at the next timer tick, the tcntn is reloaded with the temporary register value (tcntbn). 5. in interrupt service routine (isr), the tcntbn and the tcmpbn are set t o 80 (20+60) and 60, respectively, for the next duration. 6. when the tcntn has the same value as the tcmpn, the logic level of toutn is changed from low to high. 7. when the tcntn reaches 0, the tcntn is reloaded automatically with the tcntbn, triggering an interrupt request. 8. in interrupt service routine (isr), auto reload and interrupt request are disabled to stop the timer. 9. when the value of the tcntn is same as the tcmpn, the logic level of the toutn is changed from low to high. 10. even when the tcntn reaches 0, the tcntn is not any more reloaded and the timer is stopped because auto reload has been disabled. 11. no more interrupt requests are generated.
S3C2440a risc microprocessor pwm timer 10- 7 pulse width modulation (pwm) write tcmpbn = 60 write tcmpbn = 50 write tcmpbn = 40 write tcmpbn = 30 write tcmpbn = 30 write tcmpbn = next pwm value 60 50 40 30 30 figure 10-5. example of pwm pwm function can be implemented by using the tcmpbn. pwm frequency is determined by tcntbn. figure 10-5 shows a pwm value determined by tcmpbn. for a higher pwm value, decrease the tcmpbn value. for a lower pwm value, increase the tcmpbn value. if an output inverter is enabled, the increment/decrement may be reversed. the double buffering function allows the tcmpbn, for the next pwm cycle, written at any point in the current pwm cycle by isr or other routine.
pwm timer S3C2440a risc microprocessor 10- 8 output level control inverter off initial state period 1 period 2 timer stop inverter on figure 10-6. inverter on/off the following procedure describes how to maintain tout as high or low (assume the inverter is off): 1. turn off the auto reload bit. and then, toutn goes to high level and the timer is stopped after the tcntn reaches 0 (recommended). 2. stop the timer by clearing the timer start/stop bit to 0. if tcntn ? tcmpn, the output level is high. if tcntn >tcmpn, the output level is low. 3. the toutn can be inverted by the inverter on/off bit in tcon. the inverter removes the additional circuit to adjust the output level.
S3C2440a risc microprocessor pwm timer 10- 9 dead zone generator the dead zone is for the pwm control in a power device. this function enables the insertion of the time gap between a turn-off of a switching device and a turn on of another switching device. this time gap prohibits the two switching devices from being turned on simultaneously, even for a very short time. tout0 is the pwm output. ntout0 is the inversion of the tout0. if the dead zone is enabled, the output wave form of tout0 and ntout0 will be tout0_dz and ntout0_dz, respectively. ntout0_dz is routed to the tout1 pin. in the dead zone interval, tout0_dz and ntout0_dz can never be turned on simultaneously. tout0 ntout0 tout0_dz ntout0_dz deadzone interval figure 10-7. the wave form when a dead zone feature is enabled
pwm timer S3C2440a risc microprocessor 10- 10 dma request mode the pwm timer can generate a dma request at every specific time. the timer keeps dma request signals (ndma_req) low until the timer receives an ack signal. when the timer receives the ack signal, it makes the request signal inactive. the timer, which generates the dma request, is determined by setting dma mode bits (in tcfg1 register). if one of timers is configured as dma request mode, that timer does not generate an interrupt request. the others can generate interrupt normally. dma mode configuration and dma / interrupt operation dma mode dma request timer0 int timer1 int timer2 int timer3 int timer4 int 0000 no select on on on on on 0001 timer0 off on on on on 0010 timer1 on off on on on 0011 timer2 on on off on on 0100 timer3 on on on off on 0101 timer4 on on on on off 0110 no select on on on on on pclk int4tmp dmareq_en ndma_ack ndma_req int4 1 0 1 figure 10-8. timer4 dma mode operation
S3C2440a risc microprocessor pwm timer 10- 11 pwm timer control registers timer configuration register0 (tcfg0) timer input clock frequency = pclk / {prescaler value+1} / {divider value} {prescaler value} = 0~255 {divider value} = 2, 4, 8, 16 register address r/w description reset value tcfg0 0x51000000 r/w configures the two 8-bit prescalers 0x00000000 tcfg0 bit description initial state reserved [31:24] 0x00 dead zone length [23:16] these 8 bits determine the dead zone length. the 1 unit time of the dead zone length is equal to that of timer 0. 0x00 prescaler 1 [15:8] these 8 bits determine prescaler value for timer 2, 3 and 4. 0x00 prescaler 0 [7:0] these 8 bits determine prescaler value for timer 0 and 1. 0x00
pwm timer S3C2440a risc microprocessor 10- 12 timer configuration register1 (tcfg1) register address r/w description reset value tcfg1 0x51000004 r/w 5-mux & dma mode selection register 0x00000000 tcfg1 bit description initial state reserved [31:24] 00000000 dma mode [23:20] select dma request channel 0000 = no select (all interrupt) 0001 = timer0 0010 = timer1 0011 = timer2 0100 = timer3 0101 = timer4 0110 = reserved 0000 mux 4 [19:16] select mux input for pwm timer4. 0000 = 1/2 0001 = 1/4 0010 = 1/8 0011 = 1/16 01xx = external tclk1 0000 mux 3 [15:12] select mux input for pwm timer3. 0000 = 1/2 0001 = 1/4 0010 = 1/8 0011 = 1/16 01xx = external tclk1 0000 mux 2 [11:8] select mux input for pwm timer2. 0000 = 1/2 0001 = 1/4 0010 = 1/8 0011 = 1/16 01xx = external tclk1 0000 mux 1 [7:4] select mux input for pwm timer1. 0000 = 1/2 0001 = 1/4 0010 = 1/8 0011 = 1/16 01xx = external tclk0 0000 mux 0 [3:0] select mux input for pwm timer0. 0000 = 1/2 0001 = 1/4 0010 = 1/8 0011 = 1/16 01xx = external tclk0 0000
S3C2440a risc microprocessor pwm timer 10- 13 timer control (tcon) register register address r/w description reset value tcon 0x51000008 r/w timer control register 0x00000000 tcon bit description initial state timer 4 auto reload on/off [22] determine auto reload on/off for timer 4. 0 = one-shot 1 = interval mode (auto reload) 0 timer 4 manual update (note) [21] determine the manual update for timer 4. 0 = no operation 1 = update tcntb4 0 timer 4 start/stop [20] determine start/stop for timer 4. 0 = stop 1 = start for timer 4 0 timer 3 auto reload on/off [19] determine auto reload on/off for timer 3. 0 = one-shot 1 = interval mode (auto reload) 0 timer 3 output inverter on/off [18] determine output inverter on/off for timer 3. 0 = inverter off 1 = inverter on for tout3 0 timer 3 manual update (note) [17] determine manual update for timer 3. 0 = no operation 1 = update tcntb3 & tcmpb3 0 timer 3 start/stop [16] determine start/stop for timer 3. 0 = stop 1 = start for timer 3 0 timer 2 auto reload on/off [15] determine auto reload on/off for timer 2. 0 = one-shot 1 = interval mode (auto reload) 0 timer 2 output inverter on/off [14] determine output inverter on/off for timer 2. 0 = inverter off 1 = inverter on for tout2 0 timer 2 manual update (note) [13] determine the manual update for timer 2. 0 = no operation 1 = update tcntb2 & tcmpb2 0 timer 2 start/stop [12] determine start/stop for timer 2. 0 = stop 1 = start for timer 2 0 timer 1 auto reload on/off [11] determine the auto reload on/off for timer1. 0 = one-shot 1 = interval mode (auto reload) 0 timer 1 output inverter on/off [10] determine the output inverter on/off for timer1. 0 = inverter off 1 = inverter on for tout1 0 timer 1 manual update (note) [9] determine the manual update for timer 1. 0 = no operation 1 = update tcntb1 & tcmpb1 0 timer 1 start/stop [8] determine start/stop for timer 1. 0 = stop 1 = start for timer 1 0 note: the bits have to be cleared at next writing.
pwm timer S3C2440a risc microprocessor 10- 14 timer control (tcon) register ( continued ) tcon bit description initial state reserved [7:5] reserved dead zone enable [4] determine the dead zone operation. 0 = disable 1 = enable 0 timer 0 auto reload on/off [3] determine auto reload on/off for timer 0. 0 = one-shot 1 = interval mode(auto reload) 0 timer 0 output inverter on/off [2] determine the output inverter on/off for timer 0. 0 = inverter off 1 = inverter on for tout0 0 timer 0 manual update (note) [1] determine the manual update for timer 0. 0 = no operation 1 = update tcntb0 & tcmpb0 0 timer 0 start/stop [0] determine start/stop for timer 0. 0 = stop 1 = start for timer 0 0 note: the bit has to be cleared at next writing.
S3C2440a risc microprocessor pwm timer 10- 15 timer 0 count buffer register & compare buffer register (tcntb0/tcmpb0) register address r/w description reset value tcntb0 0x5100000c r/w timer 0 count buffer register 0x00000000 tcmpb0 0x51000010 r/w timer 0 compare buffer register 0x00000000 tcmpb0 bit description initial state timer 0 compare buffer register [15:0] set compare buffer value for timer 0 0x0000 0000 tcntb0 bit description initial state timer 0 count buffer register [15:0] set count buffer value for timer 0 0x0000 0000 timer 0 count observation register (tcnto0) register address r/w description reset value tcnto0 0x51000014 r timer 0 count observation register 0x00000000 tcnto0 bit description initial state timer 0 observation register [15:0] set count observation value for timer 0 0x0000 0000
pwm timer S3C2440a risc microprocessor 10- 16 timer 1 count buffer register & compare buffer register (tcntb1/tcmpb1) register address r/w description reset value tcntb1 0x51000018 r/w timer 1 count buffer register 0x00000000 tcmpb1 0x5100001c r/w timer 1 compare buffer register 0x00000000 tcmpb1 bit description initial state timer 1 compare buffer register [15:0] set compare buffer value for timer 1 0x0000 0000 tcntb1 bit description initial state timer 1 count buffer register [15:0] set count buffer value for timer 1 0x0000 0000 timer 1 count observation register (tcnto1) register address r/w description reset value tcnto1 0x51000020 r timer 1 count observation register 0x00000000 tcnto1 bit description initial state timer 1 observation register [15:0] set count observation value for timer 1 0x0000 0000
S3C2440a risc microprocessor pwm timer 10- 17 timer 2 count buffer register & compare buffer register (tcntb2/tcmpb2) register address r/w description reset value tcntb2 0x51000024 r/w timer 2 count buffer register 0x00000000 tcmpb2 0x51000028 r/w timer 2 compare buffer register 0x00000000 tcmpb2 bit description initial state timer 2 compare buffer register [15:0] set compare buffer value for timer 2 0x0000 0000 tcntb2 bit description initial state timer 2 count buffer register [15:0] set count buffer value for timer 2 0x0000 0000 timer 2 count observation register (tcnto2) register address r/w description reset value tcnto2 0x5100002c r timer 2 count observation register 0x00000000 tcnto2 bit description initial state timer 2 observation register [15:0] set count observation value for timer 2 0x0000 0000
pwm timer S3C2440a risc microprocessor 10- 18 timer 3 count buffer register & compare buffer register (tcntb3/tcmpb3) register address r/w description reset value tcntb3 0x51000030 r/w timer 3 count buffer register 0x00000000 tcmpb3 0x51000034 r/w timer 3 compare buffer register 0x00000000 tcmpb3 bit description initial state timer 3 compare buffer register [15:0] set compare buffer value for timer 3 0x0000 0000 tcntb3 bit description initial state timer 3 count buffer register [15:0] set count buffer value for timer 3 0x0000 0000 timer 3 count observation register (tcnto3) register address r/w description reset value tcnto3 0x51000038 r timer 3 count observation register 0x00000000 tcnto3 bit description initial state timer 3 observation register [15:0] set count observation value for timer 3 0x0000 0000
S3C2440a risc microprocessor pwm timer 10- 19 timer 4 count buffer register (tcntb4) register address r/w description reset value tcntb4 0x5100003c r/w timer 4 count buffer register 0x00000000 tcntb4 bit description initial state timer 4 count buffer register [15:0] set count buffer value for timer 4 0x0000 0000 timer 4 count observation register (tcnto4) register address r/w description reset value tcnto4 0x51000040 r timer 4 count observation register 0x00000000 tcnto4 bit description initial state timer 4 observation register [15:0] set count observation value for timer 4 0x0000 0000
pwm timer S3C2440a risc microprocessor 10- 20 notes
S3C2440a risc microprocessor uart 11- 1 11 uart overview the S3C2440a universal asynchronous receiver and transmitter (uart) provide three independent asynchronous serial i/o (sio) ports, each of which can operate in interrupt-based or dma-based mode. in other words, the uart can generate an interrupt or a dma request to transfer data between cpu and the uart. the uart can support bit rates up to 115.2k bps using system clock. if an external device provides the uart with uextclk, then the uart can operate at higher speed. each uart channel contains two 64-byte fifos for receiver and transmitter. the S3C2440a uart includes programmable baud rates, infrared (ir) transmit/receive, one or two stop bit insertion, 5-bit, 6-bit, 7-bit or 8-bit data width and parity checking. each uart contains a baud-rate generator, transmitter, receiver and a control unit, as shown in figure 11-1. the baud-rate generator can be clocked by pclk, fclk/n or uextclk (external input clock). the transmitter and the receiver contain 64-byte fifos and data shifters. data is written to fifo and then copied to the transmit shifter before being transmitted. the data is then shifted out by the transmit data pin (txdn). meanwhile, received data is shifted from the receive data pin (rxdn), and then copied to fifo from the shifter. features ? rxd0, txd0, rxd1, txd1, rxd2, and txd2 with dma-based or interrupt-based operation ? uart ch 0, 1, and 2 with irda 1.0 & 64-byte fifo ? uart ch 0 and 1 with nrts0, ncts0, nrts1, and ncts1 ? supports handshake transmit/receive
uart S3C2440a risc microprocessor 11- 2 block diagram buad-rate generator control unit transmitter receiver peripheral bus txdn clock source (pclk, fclk/n,uextclk) rxdn transmit fifo register (fifo mode) transmit holding register (non-fifo mode) receive fifo register (fifo mode) receive holding register (non-fifo mode only) in fifo mode, all 64 byte of buffer register are used as fifo register. in non-fifo mode, only 1 byte of buffer register is used as holding register. transmit shifter transmit buffer register(64 byte) receive shifter receive buffer register(64 byte) figure 11-1. uart block diagram (with fifo)
S3C2440a risc microprocessor uart 11- 3 uart operation the following sections describe the uart operations that include data transmission, data reception, interrupt generation, baud-rate generation, loopback mode, infrared mode, and auto flow control. data transmission the data frame for transmission is programmable. it consists of a start bit, 5 to 8 data bits, an optional parity bit and 1 to 2 stop bits, which can be specified by the line control register (ulconn). the transmitter can also produce the break condition, which forces the serial output to logic 0 state for one frame transmission time. this block transmits break signals after the present transmission word is transmitted completely. after the break signal transmission, it continuously transmits data into the tx fifo (tx holding register in the case of non-fifo mode). data reception like the transmission, the data frame for reception is also programmable. it consists of a start bit, 5 to 8 data bits, an optional parity bit and 1 to 2 stop bits in the line control register (ulconn). the receiver can detect overrun error, parity error, frame error and break condition, each of which can set an error flag. ? the overrun error indicates that new data has overwritten the ol d data before the old data has been read. ? the parity error indicates that the receiver has detected an unexpected parity condition. ? the frame error indicates that the received data does not have a valid stop bit. ? the break condition indicates that the rxdn input is held in the logic 0 state for a duration longer than one frame transmission time. receive time-out condition occurs when it does not receive any data during the 3 word time (this interval follows the setting of word length bit) and the rx fifo is not empty in the fifo mode.
uart S3C2440a risc microprocessor 11- 4 auto flow control (afc) the S3C2440a's uart 0 and uart 1 support auto flow control with nrts and ncts signals. in case, it can be connected to external uarts. if users want to connect a uart to a modem, disable auto flow control bit in umconn register and control the signal of nrts by software. in afc, nrts depends on the condition of the receiver and ncts signals control the operation of the transmitter. the uart's transmitter transfers the data in fifo only when ncts signals are activated (in afc, ncts means that other uart's fifo is ready to receive data). before the uart receives data, nrts has to be activated when its receive fifo has a spare more than 32-byte and has to be inactivated when its receive fifo has a spare under 32-byte (in afc, nrts means that its own receive fifo is ready to receive data). uart a txd ncts uart b rxd nrts transmission case in uart a uart a rxd nrts uart b txd ncts reception case in uart a figure 11-2. uart afc interface note uart 2 does not support afc function, because the S3C2440a has no nrts2 and ncts2. example of non auto-flow control (controlling nrts and ncts by software) rx operation with fifo 1. select receive mode (interrupt or dma mode). 2. check the value of rx fifo count in ufstatn register. if the value is less than 32, users have to set the value of umconn[0] to '1' (activating nrts), and if it is equal or larger than 32 users have to set the value to '0' (inactivating nrts). 3. repeat the step 2. tx operation with fifo 1. select transmit mode (interrupt or dma mode). 2. check the value of umstatn[ 0]. if the value is '1' (activating ncts), users write the data to tx fifo register.
S3C2440a risc microprocessor uart 11- 5 rs-232c interface if the user wants to connect the uart to modem interface (instead of null modem), nrts, ncts, ndsr, ndtr, dcd and nri signals are needed. in this case, the users can control these signals with general i/o ports by software because the afc does not support the rs-232c interface. interrupt/dma request generation each uart of the S3C2440a has seven status (tx/rx/error) signals: overrun error, parity error, frame error, break, receive buffer data ready, transmit buffer empty, and transmit shifter empty, all of which are indicated by the corresponding uart status register (utrstatn/uerstatn). the overrun error, parity error, frame error and break condition are referred to as the receive error status. each of which can cause the receive error status interrupt request, if the receive-error-status-interrupt-enable bit is set to one in the control register, uconn. when a receive-error-status-interrupt-request is detected, the signal causing the request can be identified by reading the value of uerststn. when the receiver transfers the data of the receive shifter to the receive fifo register in fifo mode and the number of received data reaches rx fifo trigger level, rx interrupt is generated. if the receive mode is in control register (uconn) and is selected as 1 (interrupt request or polling mode). in the non-fifo mode, transferring the data of the receive shifter to receive holding register will cause rx interrupt under the interrupt request and polling mode. when the transmitter transfers data from its transmit fifo register to its transmit shifter and the number of data left in transmit fifo reaches tx fifo trigger level, tx interrupt is generated, if transmit mode in control register is selected as interrupt request or polling mode. in the non-fifo mode, transferring data from the transmit holding register to the transmit shifter will cause tx interrupt under the interrupt request and polling mode. if the receive mode and transmit mode in control register are selected as the dman request mode then dman request occurs instead of rx or tx interrupt in the situation mentioned above. table 11-1. interrupts in connection with fifo type fifo mode non-fifo mode rx interrupt generated whenever receive data reaches the trigger level of receive fifo. generated when the number of data in fifo does not reaches rx fifo trigger level and does not receive any data during 3 word time (receive time out). this interval follows the setting of word length bit. generated by the receiving holding register whenever receive buffer becomes full. tx interrupt generated whenever transmit data reaches the trigger level of transmit fifo (tx fifo trigger level). generated by the transmitting holding register whenever transmit buffer becomes empty. error interrupt generated when frame error, parity error, or break signal are detected. generated when it gets to the top of the receive fifo without reading out data in it (overrun error). generated by all errors. however if another error occurs at the same time, only one interrupt is generated.
uart S3C2440a risc microprocessor 11- 6 uart error status fifo uart has the error status fifo besides the rx fifo register. the error status fifo indicates which data, among fifo registers, is received with an error. the error interrupt will be issued only when the data, which has an error, is ready to read out. to clear the error status fifo, the urxhn with an error and uerstatn must be read out. for example, it is assumed that the uart rx fifo receives a, b, c, d and e characters sequentially and the frame error occurs while receiving 'b', and the parity error occurs while receiving 'd'. the actual uart receive error will not generate any error interrupt because the character which is received with an error would have not been read. the error interrupt will occur once the character is read. figure 11-3 shows the uart receiving the five characters including the two errors. time sequence flow error interrupt note #0 when no character is read out ? #1 a, b, c, d, and e is received ? #2 after a is read out the frame error (in b) interrupt occurs. the 'b' has to be read out. #3 after b is read out ? #4 after c is read out the parity error (in d) interrupt occurs. the 'd' has to be read out. #5 after d is read out ? #6 after e is read out ? - - - - - - - - - - - 'e' 'd' 'c' 'b' 'a' rx fifo urxhn uerstatn break error parity error frame error error status generator unit error status fifo figure 11-3. example showing uart receiving 5 characters with 2 errors
S3C2440a risc microprocessor uart 11- 7 baud-rate generation each uart's baud-rate generator provides the serial clock for the transmitter and the receiver. the source clock for the baud-rate generator can be selected with the S3C2440a's internal system clock or uextclk. in other words, dividend is selectable by setting clock selection of uconn. the baud-rate clock is generated by dividing the source clock (pclk, fclk/n or uextclk) by 16 and a 16-bit divisor specified in the uart baud-rate divisor register (ubrdivn). the ubrdivn can be determined by the following expression: ubrdivn = (int)( uart clock / ( buad rate x 16) ) ?1 ( uart clock: pclk, fclk/n or uextclk ) where, ubrdivn should be from 1 to (2 16 -1), but can be set 0 (bypass mode) only using the uextclk which should be smaller than pclk. for example, if the baud-rate is 115200 bps and uart clock is 40 mhz, ubrdivn is: ubrdivn = (int)(40000000 / (115200 x 16) ) -1 = (int)(21.7) -1 [round to the nearest whole number] = 22 -1 = 21 baud-rate error tolerance uart frame error should be less than 1.87%(3/160). tupclk = (ubrdivn + 1) x 16 x 1frame / pclk tupclk: real uart clock tuexact = 1frame / baud-rate tuexact: ideal uart clock uart error = (tupclk ? tuexact) / tuexact x 100% notes 1. 1frame = start bit + data bit + parity bit + stop bit. 2. in specific condition, we can support the uart baud rate up to 921.6k bps. for example, when pclk is 60mhz, you can use 921.6k bps under uart error of 1.69%. loopback mode the S3C2440a uart provides a test mode referred to as the loopback mode, to aid in isolating faults in the communication link. this mode structurally enables the connection of rxd and txd in the uart. in this mode, therefore, transmitted data is received to the receiver, via rxd. this feature allows the processor to verify the internal transmit and to receive the data path of each sio channel. this mode can be selected by setting the loopback bit in the uart control register (uconn).
uart S3C2440a risc microprocessor 11- 8 infrared (ir) mode the S3C2440a uart block supports infrared (ir) transmission and reception, which can be selected by setting the infrared-mode bit in the uart line control register (ulconn). figure 11-4 illustrates how to implement the ir mode. in ir transmit mode, the transmit pulse comes out at a rate of 3/16, the normal serial transmit rate (when the transmit data bit is zero); in ir receive mode, the receiver must detect the 3/16 pulsed period to recognize a zero value (see the frame timing diagrams shown in figure 11-6 and 11-7). irda tx encoder 0 1 0 1 irda rx decoder txd rxd txd irs rxd re uart block figure 11-4. irda function block diagram
S3C2440a risc microprocessor uart 11- 9 start bit stop bit data bits sio frame 0 1 0 1 0 0 1 1 0 1 figure 11-5. serial i/o frame timing diagram (normal uart) 0 start bit stop bit data bits ir transmit frame bit time pulse width = 3/16 bit frame 0 0 0 0 1 1 1 1 1 figure 11-6. infrared transmit mode frame timing diagram 0 start bit stop bit data bits ir receive frame 0 0 0 0 1 1 1 1 1 figure 11-7. infrared receive mode frame timing diagram
uart S3C2440a risc microprocessor 11- 10 uart special registers uart line control register there are three uart line control registers including ulcon0, ulcon1, and ulcon2 in the uart block. register address r/w description reset value ulcon0 0x50000000 r/w uart channel 0 line control register 0x00 ulcon1 0x50004000 r/w uart channel 1 line control register 0x00 ulcon2 0x50008000 r/w uart channel 2 line control register 0x00 ulconn bit description initial state reserved [7] ? 0 infrared mode [6] determine whether or not to use the infrared mode. 0 = normal mode operation 1 = infrared tx/rx mode 0 parity mode [5:3] specify the type of parity generation and checking during uart transmit and receive operation. 0xx = no parity 100 = odd parity 101 = even parity 110 = parity forced/checked as 1 111 = parity forced/checked as 0 000 number of stop bit [2] specify how many stop bits are to be used for end-of-frame signal. 0 = one stop bit per frame 1 = two stop bit per frame 0 word length [1:0] indicate the number of data bits to be transmitted or received per frame. 00 = 5-bits 01 = 6-bits 10 = 7-bits 11 = 8-bits 00
S3C2440a risc microprocessor uart 11- 11 uart control register there are three uart control registers including ucon0, ucon1 and ucon2 in the uart block. register address r/w description reset value ucon0 0x50000004 r/w uart channel 0 control register 0x00 ucon1 0x50004004 r/w uart channel 1 control register 0x00 ucon2 0x50008004 r/w uart channel 2 control register 0x00 uconn bit description initial state fclk divider [15:12] divider value when the uart clock source is selected as fclk/n. ?n? is determined by ucon0[15:12], ucon1[15:12], ucon2[14:12]. ucon2[15] is fclk/n clock enable/disable bit. for setting ?n? from 7 to 21, use ucon0[15:12], for setting ?n? from 22 to 36, use ucon1[15:12], for setting ?n? from 37 to 43, use ucon2[ 14:12 ], ucon2[15]: 0 = disable fclk/n clock. 1 = enable fclk/n clock. in case of ucon0, uart clock = fclk / (divider+6), where divider>0. ucon1, ucon2 must be zero. ex) 1: uart clock = fclk/7, 2: uart clock = fclk/8 3: uart clock = fclk/9, ? , 15: uart clock = fclk/21 in case of ucon1, uart clock = fclk / (divider+21), where divider>0. ucon0, ucon2 must be zero. ex) 1: uart clock = fclk/22, 2: uart clock = fclk/23 3: uart clock = fclk/24, ? , 15: uart clock = fclk/36 in case of ucon2, uart clock = fclk / (divider+36), where divider>0. ucon0, ucon1 must be zero. ex) 1: uart clock = fclk/37, 2: uart clock = fclk/38 3: uart clock = fclk/39, ? , 7: uart clock = fclk/43 if ucon00/1[15:12] and ucon2[14:12] are all ?0?, the divider will be 44, that is uart clock = fclk/44 total division range is from 7 to 44. 0000 clock selection [11:10] select pclk, uextclk or fclk/n for the uart baud rate. ubrdivn = (int)(selected clock / (baudrate x 16) ) ?1 00, 10 = pclk 01 = uextclk 11 = fclk/n (if you would select fclk/n, you should add the code of ?note? after selecting or deselecting the fclk/n.) 0
uart S3C2440a risc microprocessor 11- 12 uart control register ( continued ) uconn bit description initial state tx interrupt type [9] interrupt request type. 0 = pulse (interrupt is requested as soon as the tx buffer becomes empty in non-fifo mode or reaches tx fifo trigger level in fifo mode.) 1 = level (interrupt is requested while tx buffer is empty in non- fifo mode or reaches tx fifo trigger level in fifo mode.) 0 rx interrupt type [8] interrupt request type. 0 = pulse (interrupt is requested the instant rx buffer receives the data in non-fifo mode or reaches rx fifo trigger level in fifo mode.) 1 = level (interrupt is requested while rx buffer is receiving data in non-fifo mode or reaches rx fifo trigger level in fifo mode.) 0 rx time out enable [7] enable/disable rx time out interrupt when uart fifo is enabled. the interrupt is a receive interrupt. 0 = disable 1 = enable 0 rx error status interrupt enable [6] enable the uart to generate an interrupt upon an exception, such as a break, frame error, parity error, or overrun error during a receive operation. 0 = do not generate receive error status interrupt. 1 = generate receive error status interrupt. 0 loopback mode [5] setting loopback bit to 1 causes the uart to enter the loopback mode. this mode is provided for test purposes only. 0 = normal operation 1 = loopback mode 0 send break signal [4] setting this bit causes the uart to send a break during 1 frame time. this bit is automatically cleared after sending the break signal. 0 = normal transmit 1 = send break signal 0 note: you should add following codes after selecting or deselecting the fclk/n. rgphcon = rgphcon & ~(3<<16); //gph8(uextclk) input delay(1); // about 100us rgphcon = rgphcon & ~(3<<16) | (1<<17); //gph8(uextclk) uextclk
S3C2440a risc microprocessor uart 11- 13 uart control register ( continued ) uconn bit description initial state transmit mode [3:2] determine which function is currently able to write tx data to the uart transmit buffer register. (uart tx enable/disable) 00 = disable 01 = interrupt request or polling mode 10 = dma0 request (only for uart0), dma3 request (only for uart2) 11 = dma1 request (only for uart1) 00 receive mode [1:0] determine which function is currently able to read data from uart receive buffer register. (uart rx enable/disable) 00 = disable 01 = interrupt request or polling mode 10 = dma0 request (only for uart0), dma3 request (only for uart2) 11 = dma1 request (only for uart1) 00 note: when the uart does not reach the fifo trigger level and does not receive data during 3 word time in dma receive mode with fifo, the rx interrupt will be generated (receive time out), and the users should check the fifo status and read out the rest.
uart S3C2440a risc microprocessor 11- 14 uart fifo control register there are three uart fifo control registers including ufcon0, ufcon1 and ufcon2 in the uart block. register address r/w description reset value ufcon0 0x50000008 r/w uart channel 0 fifo control register 0x0 ufcon1 0x50004008 r/w uart channel 1 fifo control register 0x0 ufcon2 0x50008008 r/w uart channel 2 fifo control register 0x0 ufconn bit description initial state tx fifo trigger level [7:6] determine the trigger level of transmit fifo. 00 = empty 01 = 16-byte 10 = 32-byte 11 = 48-byte 00 rx fifo trigger level [5:4] determine the trigger level of receive fifo. 00 = 1-byte 01 = 8-byte 10 = 16-byte 11 = 32-byte 00 reserved [3] ? 0 tx fifo reset [2] auto-cleared after resetting fifo 0 = normal 1 = tx fifo reset 0 rx fifo reset [1] auto-cleared after resetting fifo 0 = normal 1 = rx fifo reset 0 fifo enable [0] 0 = disable 1 = enable 0 note: when the uart does not reach the fifo trigger level and does not receive data during 3 word time in dma receive mode with fifo, the rx interrupt will be generated (receive time out), and the users should check the fifo status and read out the rest.
S3C2440a risc microprocessor uart 11- 15 uart modem control register there are two uart modem control registers including umcon0 and umcon1 in the uart block. register address r/w description reset value umcon0 0x5000000c r/w uart channel 0 modem control register 0x0 umcon1 0x5000400c r/w uart channel 1 modem control register 0x0 reserved 0x5000800c ? reserved undef umconn bit description initial state reserved [7:5] these bits must be 0's 00 auto flow control (afc) [4] 0 = disable 1 = enable 0 reserved [3:1] these bits must be 0's 00 request to send [0] if afc bit is enabled, this value will be ignored. in this case the S3C2440a will control nrts automatically. if afc bit is disabled, nrts must be controlled by software. 0 = 'h' level (inactivate nrts) 1 = 'l' level (activate nrts) 0 note: uart 2 does not support afc function, because the S3C2440a has no nrts2 and ncts2.
uart S3C2440a risc microprocessor 11- 16 uart tx/rx status register there are three uart tx/rx status registers including utrstat0, utrstat1 and utrstat2 in the uart block. register address r/w description reset value utrstat0 0x50000010 r uart channel 0 tx/rx status register 0x6 utrstat1 0x50004010 r uart channel 1 tx/rx status register 0x6 utrstat2 0x50008010 r uart channel 2 tx/rx status register 0x6 utrstatn bit description initial state transmitter empty [2] set to 1 automatically when the transmit buffer register has no valid data to transmit and the transmit shift register is empty. 0 = not empty 1 = transmitter (transmit buffer & shifter register) empty 1 transmit buffer empty [1] set to 1 automatically when transmit buffer register is empty. 0 =the buffer register is not empty 1 = empty (in non-fifo mode, interrupt or dma is requested. in fifo mode, interrupt or dma is requested, when tx fifo trigger level is set to 00 (empty)) if the uart uses the fifo, users should check tx fifo count bits and tx fifo full bit in the ufstat register instead of this bit. 1 receive buffer data ready [0] set to 1 automatically whenever receive buffer register contains valid data, received over the rxdn port. 0 = empty 1 = the buffer register has a received data (in non-fifo mode, interrupt or dma is requested) if the uart uses the fifo, users should check rx fifo count bits and rx fifo full bit in the ufstat register instead of this bit. 0
S3C2440a risc microprocessor uart 11- 17 uart error status register there are three uart rx error status registers including uerstat0, uerstat1 and uerstat2 in the uart block. register address r/w description reset value uerstat0 0x50000014 r uart channel 0 rx error status register 0x0 uerstat1 0x50004014 r uart channel 1 rx error status register 0x0 uerstat2 0x50008014 r uart channel 2 rx error status register 0x0 uerstatn bit description initial state break detect [3] set to 1 automatically to indicate that a break signal has been received. 0 = no break receive 1 = break receive (interrupt is requested.) 0 frame error [2] set to 1 automatically whenever a frame error occurs during receive operation. 0 = no frame error during receive 1 = frame error (interrupt is requested.) 0 parity error [1] set to 1 automatically whenever a parity error occurs during receive operation. 0 = no parity error during receive 1 = parity error (interrupt is requested.) 0 overrun error [0] set to 1 automatically whenever an overrun error occurs during receive operation. 0 = no overrun error during receive 1 = overrun error (interrupt is requested.) 0 note: these bits (uersatn[3:0]) are automatically cleared to 0 when the uart error status register is read.
uart S3C2440a risc microprocessor 11- 18 uart fifo status register there are three uart fifo status registers including ufstat0, ufstat1 and ufstat2 in the uart block. register address r/w description reset value ufstat0 0x50000018 r uart channel 0 fifo status register 0x00 ufstat1 0x50004018 r uart channel 1 fifo status register 0x00 ufstat2 0x50008018 r uart channel 2 fifo status register 0x00 ufstatn bit description initial state reserved [15] 0 tx fifo full [14] set to 1 automatically whenever transmit fifo is full during transmit operation 0 = 0-byte tx fifo data 63-byte 1 = full 0 tx fifo count [13:8] number of data in tx fifo 0 reserved [7] ? 0 rx fifo full [6] set to 1 automatically whenever receive fifo is full during receive operation 0 = 0-byte rx fifo data 63-byte 1 = full 0 rx fifo count [5:0] number of data in rx fifo 0
S3C2440a risc microprocessor uart 11- 19 uart modem status register there are two uart modem status registers including umstat0, umstat1 in the uart block. register address r/w description reset value umstat0 0x5000001c r uart channel 0 modem status register 0x0 umstat1 0x5000401c r uart channel 1 modem status register 0x0 reserved 0x5000801c ? reserved undef umstat0 bit description initial state delta cts [4] indicate that the ncts input to the S3C2440a has changed state since the last time it was read by cpu. (refer to figure 11-8.) 0 = has not changed 1 = has changed 0 reserved [3:1] ? 0 clear to send [0] 0 = cts signal is not activated (ncts pin is high) 1 = cts signal is activated (ncts pin is low) 0 ncts delta cts read_umstat figure 11-8. ncts and delta cts timing diagram
uart S3C2440a risc microprocessor 11- 20 uart transmit buffer register (holding register & fifo register) there are three uart transmit buffer registers including utxh0, utxh1 and utxh2 in the uart block. utxhn has an 8-bit data for transmission data. register address r/w description reset value utxh0 0x50000020(l) 0x50000023(b) w (by byte) uart channel 0 transmit buffer register ? utxh1 0x50004020(l) 0x50004023(b) w (by byte) uart channel 1 transmit buffer register ? utxh2 0x50008020(l) 0x50008023(b) w (by byte) uart channel 2 transmit buffer register ? utxhn bit description initial state txdatan [7:0] transmit data for uartn ? note: (l): the endian mode is little endian. (b): the endian mode is big endian. uart receive buffer register (holding register & fifo register) there are three uart receive buffer registers including urxh0, urxh1 and urxh2 in the uart block. urxhn has an 8-bit data for received data. register address r/w description reset value urxh0 0x50000024(l) 0x50000027(b) r (by byte) uart channel 0 receive buffer register ? urxh1 0x50004024(l) 0x50004027(b) r (by byte) uart channel 1 receive buffer register ? urxh2 0x50008024(l) 0x50008027(b) r (by byte) uart channel 2 receive buffer register ? urxhn bit description initial state rxdatan [7:0] receive data for uartn ? note: when an overrun error occurs, the urxhn must be read. if not, the next received data will also make an overrun error, even though the overrun bit of uerstatn had been cleared.
S3C2440a risc microprocessor uart 11- 21 uart baud rate divisor register there are three uart baud rate divisor registers including ubrdiv0, ubrdiv1 and ubrdiv2 in the uart block. the value stored in the baud rate divisor register (ubrdivn), is used to determine the serial tx/rx clock rate (baud rate) as follows: ubrdivn = (int)( uart clock / ( buad rate x 16) ) ?1 ( uart clock: pclk, fclk/n or uextclk ) where, ubrdivn should be from 1 to (2 16 -1), but can be set zero only using the uextclk which should be smaller than pclk. for example, if the baud-rate is 115200 bps and uart clock is 40 mhz, ubrdivn is: ubrdivn = (int)(40000000 / (115200 x 16) ) -1 = (int)(21.7) -1 [round to the nearest whole number] = 22 -1 = 21 register address r/w description reset value ubrdiv0 0x50000028 r/w baud rate divisior register 0 ? ubrdiv1 0x50004028 r/w baud rate divisior register 1 ? ubrdiv2 0x50008028 r/w baud rate divisior register 2 ? ubrdivn bit description initial state ubrdiv [15:0] baud rate division value ubrdivn > 0 using the uextclk as input clock, ubrdivn can be set ?0?. ?
uart S3C2440a risc microprocessor 11- 22 notes
S3C2440a risc microprocessor usb host 12- 1 12 usb host controller overview S3C2440a supports 2-port usb host interface as follows: ? ohci rev 1.0 compatible ? usb rev1.1 compatible ? two down stream ports ? support for both lowspeed and fullspeed usb devices hci slave block app_sadr(8) app_sdata(32) hci_data(32) control control ohci regs usb state control list processor block ed&td regs cntl hci master block control ed/td_data(32) ed/td status(32) 64x8 fifo cntl hc_data(8) df_data(8) app_mdata(32) hcm_adr/ data(32) control status control ctrl ctrl rh_data(8) df_data(8) hcf_data(8) addr(6) fifo_data(8) 64x8 fifo root hub & host sie hsie s/m dpll root hub & host sie ohci root hub regs port s/m port s/m port s/m x v r usb 1 x v r usb 2 hci bus ext.fifo status rcf0_regdata(32) txenl txdpls txdmns rcvdata rcvdpls rcvdmns figure 12-1. usb host controller block diagram
usb host S3C2440a risc microprocessor 12- 2 usb host controller special registers the S3C2440a usb host controller complies with ohci rev 1.0. refer to open host controller interface rev 1.0 specification for detailed information. ohci registers for usb host controller register base address r/w description reset value hcrevision 0x49000000 ? control and status group ? hccontrol 0x49000004 ? ? hccommonstatus 0x49000008 ? ? hcinterruptstatus 0x4900000c ? ? hcinterruptenable 0x49000010 ? ? hcinterruptdisable 0x49000014 ? ? hchcca 0x49000018 ? memory pointer group ? hcperiodcuttented 0x4900001c ? ? hccontrolheaded 0x49000020 ? ? hccontrolcurrented 0x49000024 ? ? hcbulkheaded 0x49000028 ? ? hcbulkcurrented 0x4900002c ? ? hcdonehead 0x49000030 ? ? hcrminterval 0x49000034 ? frame counter group ? hcfmremaining 0x49000038 ? ? hcfmnumber 0x4900003c ? ? hcperiodicstart 0x49000040 ? ? hclsthreshold 0x49000044 ? ? hcrhdescriptora 0x49000048 ? root hub group ? hcrhdescriptorb 0x4900004c ? ? hcrhstatus 0x49000050 ? ? hcrhportstatus1 0x49000054 ? ? hcrhportstatus2 0x49000058 ? ?
S3C2440a risc microprocessor usb device 13- 1 13 usb device controller overview universal serial bus (usb) device controller is designed to provide a high performance full speed function controller solution with dma interface. usb device controller allows bulk transfer with dma, interrupt transfer and control transfer. usb device controller supports: ? full speed usb device controller compatible with the usb specification version 1.1 ? dma interface for bulk transfer ? five endpoints with fifo ep0: 16byte (register) ep1: 128byte in/out fifo (dual port asynchronous ram): interrupt or dma ep2: 128byte in/out fifo (dual port asynchronous ram): interrupt or dma ep3: 128byte in/out fifo (dual port asynchronous ram): interrupt or dma ep4: 128byte in/out fifo (dual port asynchronous ram): interrupt or dma ? in tegrated usb transceiver feature ? fully compliant with usb specification version 1.1 ? full speed (12mbps) device ? integrated usb transceiver ? supports control, interrupt and bulk transfer ? five endpoints with fifo: one bi-directional control endpoint with 16-byte fifo (ep0) four bi-directional bulk endpoints with 128-byte fifo (ep1, ep2, ep3, and ep4) ? supports dma interface for receive and transmit bulk endpoints. (ep1, ep2, ep3, and ep4) ? independent 128-byte receive and transmit fifo to maximize throughput ? supports suspend and remote wakeup function note pclk should be more than 20mhz to use usb controller in stable condition.
usb device S3C2440 a risc microprocessor 13- 2 sie rt_vp_out rt_vm_in rt_vp_in rxd rt_uxsuspend rt_ux_oen rt_vm_out mc_addr[13:0] siu gfi fifos mcu & dma i/f mc_data_in[31:0] mc_data_out[31:0] usb_clk sys_clk sys_resetn mc_wr wr_rdn mc_csn mc_intr dreqn[3:0] dackn[3:0] figure 13-1. usb device controller block diagram
S3C2440a risc microprocessor usb device 13- 3 usb device controller special registers this section describes detailed functionalities about register sets of usb device controller. all special function register is byte-accessible or word-accessible. if you access byte mode offset-address is different in little endian and big endian. all reserved bit is zero. common indexed registers depend on index register (index_reg) (offset address: 0x178) value. for example if you want to write ep0 csr register, you must write ?0x00? on the index_reg before writing in_csr1 register. note all register must be resettled after performing host reset signaling. register name description offset address non indexed registers func_addr_reg function address register 0x140(l) / 0x143(b) pwr_reg power management register 0x144(l) / 0x147(b) ep_int_reg (ep0?ep4) endpoint interrupt register 0x148(l) / 0x14b(b) usb_int_reg usb interrupt register 0x158(l) / 0x15b(b) ep_int_en_reg (ep0?ep4) endpoint interrupt enable register 0x15c(l) / 0x15f(b) usb_int_en_reg usb interrupt enable register 0x16c(l) / 0x16f(b) frame_num1_reg frame number 1 register 0x170(l) / 0x173(b) frame_num2_reg frame number 2 register 0x174(l) / 0x177(b) index_reg index register 0x178(l) / 0x17b(b) ep0_fifo_reg endpoint0 fifo register 0x1c0(l) / 0x1c3(b) ep1_fifo_reg endpoint1 fifo register 0x1c4(l) / 0x1c7(b) ep2_fifo_reg endpoint2 fifo register 0x1c8(l) / 0x1cb(b) ep3_fifo_reg endpoint3 fifo register 0x1cc(l) / 0x1cf(b) ep4_fifo_reg endpoint4 fifo register 0x1d0(l) / 0x1d3(b) ep1_dma_con endpoint1 dma control register 0x200(l) / 0x203(b) ep1_dma_unit endpoint1 dma unit counter register 0x204(l) / 0x207(b) ep1_dma_fifo endpoint1 dma fifo counter register 0x208(l) / 0x20b(b) ep1_dma_ttc_l endpoint1 dma transfer counter low- byte register 0x20c(l) / 0x20f(b) ep1_dma_ttc_m endpoint1 dma transfer counter middle-byte register 0x210(l) / 0x213(b) ep1_dma_ttc_h endpoint1 dma transfer counter high- byte register 0x214(l) / 0x217(b) ep2_dma_con endpoint2 dma control register 0x218(l) / 0x21b(b)
usb device S3C2440 a risc microprocessor 13- 4 usb device controller special registers ( continued ) register name description offset address ep2_dma_unit endpoint2 dma unit counter register 0x21c(l) / 0x21f(b) ep2_dma_fifo endpoint2 dma fifo counter register 0x220(l) / 0x223(b) ep2_dma_ttc_l endpoint2 dma transfer counter low- byte register 0x224(l) / 0x227(b) ep2_dma_ttc_m endpoint2 dma transfer counter middle-byte register 0x228(l) / 0x22b(b) ep2_dma_ttc_h endpoint2 dma transfer counter high- byte register 0x22c(l) / 0x22f(b) ep3_dma_con endpoint3 dma control register 0x240(l) / 0x243(b) ep3_dma_unit endpoint3 dma unit counter register 0x244(l) / 0x247(b) ep3_dma_fifo endpoint3 dma fifo counter register 0x248(l) / 0x24b(b) ep3_dma_ttc_l endpoint3 dma transfer counter low- byte register 0x24c(l) / 0x24f(b) ep3_dma_ttc_m endpoint3 dma transfer counter middle-byte register 0x250(l) / 0x253(b) ep3_dma_ttc_h endpoint3 dma transfer counter high- byte register 0x254(l) / 0x247(b) ep4_dma_con endpoint4 dma control register 0x258(l) / 0x25b(b) ep4_dma_unit endpoint4 dma unit counter register 0x25c(l) / 0x25f(b) ep4_dma_fifo endpoint4 dma fifo counter register 0x260(l) / 0x263(b) ep4_dma_ttc_l endpoint4 dma transfer counter low- byte register 0x264(l) / 0x267(b) ep4_dma_ttc_m endpoint4 dma transfer counter middle-byte register 0x268(l) / 0x26b(b) ep4_dma_ttc_h endpoint4 dma transfer counter high- byte register 0x26c(l) / 0x26f(b) common indexed registers maxp_reg endpoint max packet register 0x180(l) / 0x183(b) in indexed registers in_csr1_reg/ep0_csr ep in control status register 1/ep0 control status register 0x184(l) / 0x187(b) in_csr2_reg ep in control status register 2 0x188(l) / 0x18b(b) out indexed registers out_csr1_reg ep out control status register 1 0x190(l) / 0x193(b) out_csr2_reg ep out control status register 2 0x194(l) / 0x197(b) out_fifo_cnt1_reg ep out write count register 1 0x198(l) / 0x19b(b) out_fifo_cnt2_reg ep out write count register 2 0x19c(l) / 0x19f(b)
S3C2440a risc microprocessor usb device 13- 5 function address register (func_addr_reg) this register maintains the usb device controller address assigned by the host. the micro controller unit (mcu) writes the value received through a set_address descriptor to this register. this address is used for the next token. register address r/w description reset value func_addr_reg 0x52000140(l) 0x52000143(b) r/w (byte) function address register 0x00 func_addr_reg bit mcu usb description initial state addr_update [7] r /set r /clear set by the mcu whenever it updates the function_addr field in this register. this bit will be cleared by usb when data_end bit in ep0_csr register. 0 function_addr [6:0] r/w r the mcu write the unique address, assigned by host, to this field. 00
usb device S3C2440 a risc microprocessor 13- 6 power management register (pwr_reg) this register acts as a power control register in the usb block. register address r/w description reset value pwr_reg 0x52000144(l) 0x52000147(b) r/w (byte) power management register 0x00 pwr_addr bit mcu usb description initial state reserved [7:4] ? ? ? ? usb_reset [3] r set set by the usb if reset signaling is received from the host. this bit remains set as long as reset signaling persists on the bus 0 mcu_resume [2] r/w r /clear set by the mcu for mcu resume. the usb generates the resume signaling during 10ms, if this bit is set in suspend mode. suspend_mode [1] r set /clear set by usb automatically when the device enter into suspend mode. it is cleared under the following conditions: 1) the mcu clears the mcu_resume bit by writing ?0?, in order to end remote resume signaling. 2) the resume signal from host is received. 0 suspend_en [0] r/w r suspend mode enable control bit 0 = disable (default). the device will not enter suspend mode. 1 = enable suspend mode 0
S3C2440a risc microprocessor usb device 13- 7 interrupt register (ep_int_reg/usb_int_reg) the usb core has two interrupt registers. these registers act as status registers for the mcu when it is interrupted. the bits are cleared by writing a ?1? (not ?0?) to each bit that was set. once the mcu is interrupted, mcu should read the contents of interrupt-related registers and write back to clear the contents if it is necessary. register address r/w description reset value ep_int_reg 0x52000148(l) 0x5200014b(b) r/w (byte) ep interrupt pending/clear register 0x00 ep_int_reg bit mcu usb description initial state ep1~ep4 interrupt [4:1] r /clear set for bulk/interrupt in endpoints: set by the usb under the following conditions: 1. in_pkt_rdy bit is cleared. 2. fifo is flushed 3. sent_stall set. for bulk/interrupt out endpoints: set by the usb under the following conditions: 1. sets out_pkt_rdy bit 2. sets sent_stall bit 0 ep0 interrupt [0] r /clear set correspond to endpoint 0 interrupt. set by the usb under the following conditions: 1. out_pkt_rdy bit is set. 2. in_pkt_rdy bit is cleared. 3. sent_stall bit is set 4. setup_end bit is set 5. data_end bit is cleared (it indicates the end of control transfer). 0
usb device S3C2440 a risc microprocessor 13- 8 interrupt register (ep_int_reg/usb_int_reg) ( continued ) register address r/w description reset value usb_int_reg 0x52000158(l) 0x5200015b(b) r/w (byte) usb interrupt pending/clear register 0x00 usb_int_reg bit mcu usb description initial state reset interrupt [2] r /clear set set by the usb when it receives reset signaling. 0 resume interrupt [1] r /clear set set by the usb when it receives resume signaling, while in suspend mode . if the resume occurs due to a usb reset, then the mcu is first interrupted with a resume interrupt. once the clocks resume and the se0 condition persists for 3ms, usb reset interrupt will be asserted. 0 suspend interrupt [0] r /clear set set by the usb when it receives suspend signalizing. this bit is set whenever there is no activity for 3ms on the bus. thus, if the mcu does not stop the clock after the first suspend interrupt, it will continue to be interrupted every 3ms as long as there is no activity on the usb bus. by default, this interrupt is disabled. 0
S3C2440a risc microprocessor usb device 13- 9 interrupt enable register (ep_int_en_reg/usb_int_en_reg) corresponding to each interrupt register, the usb device controller also has two interrupt enable registers (except resume interrupt enable). by default, usb reset interrupt is enabled. if bit = 0, the interrupt is disabled. if bit = 1, the interrupt is enabled. register address r/w description reset value ep_int_en_reg 0x5200015c(l) 0x5200015f(b) r/w (byte) determine which interrupt is enabled 0xff ep_int_en_reg bit mcu usb description initial state ep4_int_en [4] r/w r ep4 interrupt enable bit 0 = interrupt disable 1 = enable 1 ep3_int_en [3] r/w r ep3 interrupt enable bit 0 = interrupt disable 1 = enable 1 ep2_int_en [2] r/w r ep2 interrupt enable bit 0 = interrupt disable 1 = enable 1 ep1_int_en [1] r/w r ep1 interrupt enable bit 0 = interrupt disable 1 = enable 1 ep0_int_en [0] r/w r ep0 interrupt enable bit 0 = interrupt disable 1 = enable 1 register address r/w description reset value usb_int_en_reg 0x520016c(l) 0x5200016f(b) r/w (byte) determine which interrupt is enabled 0x04 int_mask_reg bit mcu usb description initial state reset_int_en [2] r/w r reset interrupt enable bit 0 = interrupt disable 1 = enable 1 reserved [1] ? ? ? 0 suspend_int_en [0] r/w r suspend interrupt enable bit 0 = interrupt disable 1 = enable 0
usb device S3C2440 a risc microprocessor 13- 10 frame number register (fpame_num1_reg/frame_num2_reg) when the host transfers usb packets, each start of frame (sof) packet includes a frame number. the usb device controller catches this frame number and loads it into this register automatically. register address r/w description reset value frame_num1_reg 0x52000170(l) 0x52000173(b) r (byte) frame number lower byte register 0x00 frame_num_reg bit mcu usb description initial state frame_num1 [7:0] r w frame number lower byte value 00 register address r/w description reset value frame_num2_reg 0x52000174(l) 0x52000177(b) r (byte) frame number higher byte register 0x00 frame_num_reg bit mcu usb description initial state frame_num2 [7:0] r w frame number higher byte value 00
S3C2440a risc microprocessor usb device 13- 11 index register (index_reg) the index register is used to indicate certain endpoint registers effectively. the mcu can access the endpoint registers (maxp_reg, in_csr1_reg, in_csr2_reg, out_csr1_reg, out_csr2_reg, out_fifo_cnt1_reg, and out_fifo_cnt2_reg) for an endpoint inside the core using the index register. register address r/w description reset value index_reg 0x52000178(l) 0x5200017b(b) r/w (byte) register index register 0x00 index_reg bit mcu usb description initial state index [7:0] r/w r indicate a certain endpoint 00 max packet register (maxp_reg) register address r/w description reset value maxp_reg 0x52000180(l) 0x52000183(b) r/w (byte) end point max packet register 0x01 maxp_reg bit mcu usb description initial state maxp [3:0] r/w r 0000: reserved 0001: maxp = 8 byte 0010: maxp = 16 byte 0100: maxp = 32 byte 1000: maxp = 64 byte for ep0, maxp=8 is recommended. for ep1~4, maxp=64 is recommended. and, if maxp=64, the dual packet mode will be enabled automatically. 0001
usb device S3C2440 a risc microprocessor 13- 12 end point0 control status register (ep0_csr) this register has the control and status bits for endpoint 0. since a control transaction is involved with both in and out tokens, there is only one csr register, mapped to the in csr1 register. (share in1_csr and can access by writing index register ?0? and read/write in1_csr) register address r/w description reset value ep0_csr 0x52000184(l) 0x52000187(b) r/w (byte) endpoint 0 status register 0x00 ep0_csr bit mcu usb description initial state serviced_set up_end [7] w clear the mcu should write a "1" to this bit to clear setup_end. 0 serviced_out _pkt_rdy [6] w clear the mcu should write a "1" to this bit to clear out_pkt_rdy. 0 send_stall [5] r/w clear mcu should write a "1" to this bit at the same time it clears out_pkt_rdy, if it decodes an invalid token. 0 = finish the stall condition 1 = the usb issues a stall and shake to the current control transfer. 0 setup_end [4] r set set by the usb when a control transfer ends before data_end is set. when the usb sets this bit, an interrupt is generated to the mcu. when such a condition occurs, the usb flushes the fifo and invalidates mcu access to the fifo. 0 data_end [3] set clear set by the mcu on the conditions below: 1. after loading the last packet of data into the fifo, at the same time in_pkt_rdy is set. 2. while it clears out_pkt_rdy after unloading the last packet of data. 3. for a zero length data phase. 0 sent_stall [2] clear set set by the usb if a control transaction is stopped due to a protocol violation. an interrupt is generated when this bit is set. the mcu should write "0" to clear this bit. 0 in_pkt_rdy [1] set clear set by the mcu after writing a packet of data into ep0 fifo. the usb clears this bit once the packet has been successfully sent to the host. an interrupt is generated when the usb clears this bit, so as the mcu to load the next packet. for a zero length data phase, the mcu sets data_end at the same time. 0 out_pkt_rdy [0] r set set by the usb once a valid token is written to the fifo. an interrupt is generated when the usb sets this bit. the mcu clears this bit by writing a "1" to the serviced_out_pkt_rdy bit. 0
S3C2440a risc microprocessor usb device 13- 13 end point in control status register (in_csr1_reg/in_csr2_reg) register address r/w description reset value in_csr1_reg 0x52000184(l) 0x52000187(b) r/w (byte) in end point control status register1 0x00 in_csr1_reg bit mcu usb description initial state reserved [7] ? ? ? ? clr_data_ toggle [6] r/w r/ clear used in set-up procedure. 0: there are alternation of data0 and data1 1: the data toggle bit is cleared and pid in packet will maintain data0 0 sent_stall [5] r/ clear set set by the usb when an in token issues a stall handshake, after the mcu sets send_stall bit to start stall handshaking. when the usb issues a stall handshake, in_pkt_rdy is cleared 0 send_stall [4] w/r r 0: the mcu clears this bit to finish the stall condition. 1: the mcu issues a stall handshake to the usb. 0 fifo_flush [3] r/w clear set by the mcu if it intends to flush the packet in input-related fifo. this bit is cleared by the usb when the fifo is flushed. the mcu is interrupted when this happens. if a token is in process, the usb waits until the transmission is complete before fifo flushing. if two packets are loaded into the fifo, only first packet (the packet is intended to be sent to the host) is flushed, and the corresponding in_pkt_rdy bit is cleared 0 reserved [2:1] ? ? ? ? in_pkt_rdy [0 r/set clear set by the mcu after writing a packet of data into the fifo. the usb clears this bit once the packet has been successfully sent to the host. an interrupt is generated when the usb clears this bit, so the mcu can load the next packet. while this bit is set, the mcu will not be able to write to the fifo. if the mcu sets send stall bit, this bit cannot be set. 0
usb device S3C2440 a risc microprocessor 13- 14 end point in control status register (in_csr1_reg/in_csr2_reg) ( continued ) register address r/w description reset value in_csr2_reg 0x52000188(l) 0x5200018b(b) r/w (byte) in end point control status register2 0x20 in_csr2_reg bit mcu usb description initial state auto_set [7] r/w r if set, whenever the mcu writes maxp data, in_pkt_rdy will automatically be set by the core without any intervention from mcu. if the mcu writes less than maxp data, in_pkt_rdy bit has to be set by the mcu. 0 iso [6] r/w r used only for endpoints whose transfer type is programmable. 1: reserved 0: configures endpoint to bulk mode 0 mode_in [5] r/w r used only for endpoints whose direction is programmable. 1: configures endpoint direction as in 0: configures endpoint direction as out 1 in_dma_int_en [4] r/w r determine whether the interrupt should be issued or not, when the in_pkt_rdy condition happens. this is only useful for dma mode. 0 = interrupt enable, 1 = interrupt disable 0 reserved [3:0] ? ? ? ?
S3C2440a risc microprocessor usb device 13- 15 end point out control status register (out_csr1_reg/out_csr2_reg) register address r/w description reset value out_csr1_reg 0x52000190(l) 0x52000193(b) r/w (byte) end point out control status register1 0x00 out_csr1_reg bit mcu usb description initial state clr_data_toggle [7] r/w clear when the mcu writes a 1 to this bit, the data toggle sequence bit is reset to data0. 0 sent_stall [6] clear /r set set by the usb when an out token is ended with a stall handshake. the usb issues a stall handshake to the host if it sends more than maxp data for the out token. 0 send_stall [5] r/w r 0: the mcu clears this bit to end the stall condition handshake, in pkt rdy is cleared. 1: the mcu issues a stall handshake to the usb. the mcu clears this bit to end the stall condition handshake, in pkt rdy is cleared. 0 fifo_flush [4] r/w clear the mcu writes a 1 to flush the fifo. this bit can be set only when out_pkt_rdy (d0) is set. the packet due to be unloaded by the mcu will be flushed. 0 reserved [3:1] ? ? ? 0 out_pkt_rdy [0] r/ clear set set by the usb after it has loaded a packet of data into the fifo. once the mcu reads the packet from fifo, this bit should be cleared by mcu (write a "0"). 0
usb device S3C2440 a risc microprocessor 13- 16 end point out control status register (out_csr1_reg/out_csr2_reg) ( continued ) register address r/w description reset value out_csr2_reg 0x52000194(l) 0x52000197(b) r/w (byte) end point out control status register2 0x00 out_csr2_reg bit mcu usb description initial state auto_clr [7] r/w r if the mcu is set, whenever the mcu reads data from the out fifo, out_pkt_rdy will automatically be cleared by the logic without any intervention from the mcu. 0 iso [6] r/w r determine endpoint transfer type. 0: configures endpoint to bulk mode. 1: reserved. 0 out_dma_int_mask [5] r/w r determine whether the interrupt should be issued or not. out_pkt_rdy condition happens. this is only useful for dma mode 0 = interrupt enable 1 = interrupt disable 0
S3C2440a risc microprocessor usb device 13- 17 end point out write count register (out_fifo_cnt1_reg/out_fifo_cnt2_reg) these registers maintain the number of bytes in the packet as the number is unloaded by the mcu. register address r/w description reset value out_fifo_cnt1_reg 0x52000198(l) 0x5200019b(b) r (byte) end point out write count register1 0x00 out_fifo_cnt1_reg bit mcu usb description initial state out_cnt_low [7:0] r w lower byte of write count 0x00 register address r/w description reset value out_fifo_cnt2_reg 0x5200019c(l) 0x5200019f(b) r (byte) end point out write count register2 0x00 out_fifo_cnt2_reg bit mcu usb description initial state out_cnt_high [7:0] r w higher byte of write count. the out_cnt_high may be always 0 normally. 0x00 end point fifo register (epn_fifo_reg) the epn_fifo_reg enables the mcu to access to the epn fifo. register address r/w description reset value ep0_fifo 0x520001c0(l) 0x520001c3 (b) r/w (byte) end point0 fifo register 0xxx ep1_fifo 0x520001c4(l) 0x520001c7(b) r/w (byte) end point1 fifo register 0xxx ep2_fifo 0x520001c8(l) 0x520001cb(b) r/w (byte) end point2 fifo register 0xxx ep3_fifo 0x520001cc(l) 0x520001cf(b) r/w (byte) end point3 fifo register 0xxx ep4_fifo 0x520001d0(l) 0x520001d3(b) r/w (byte) end point4 fifo register 0xxx epn_fifo bit mcu usb description initial state fifo_data [7:0] r/w r/w fifo data value 0xxx
usb device S3C2440 a risc microprocessor 13- 18 dma interface control register (epn_dma_con) register address r/w description reset value ep1_dma_con 0x52000200(l) 0x52000203(b) r/w (byte) ep1 dma interface control register 0x00 ep2_dma_con 0x52000218(l) 0x5200021b(b) r/w (byte) ep2 dma interface control register 0x00 ep3_dma_con 0x52000240(l) 0x52000243(b) r/w (byte) ep3 dma interface control register 0x00 ep4_dma_con 0x52000258(l) 0x5200025b(b) r/w (byte) ep4 dma interface control register 0x00 epn_dma_con bit mcu usb description initial state run_ob [7] r/w w read) dma run observation 0: dma is stopped 1:dma is running write) ignore epn_dma_ttc_n register 0: dma requests will be stopped if epn_dma_ttc_n reaches 0. 1: dma requests will be continued although epn_dma_ttc_n reaches 0. 0 state [6:4] r w dma state monitoring 0 demand_mode [3] r/w r dma demand mode enable bit 0: demand mode disable 1: demand mode enable 0 out_run_ob / out_dma_run [2] r/w r/w functionally separated into write and read operation. write operation: ?0? = stop ?1? = run read operation: out dma run observation 0 in_dma_run [1] r/w r start dma operation. 0 = stop 1 = run 0 dma_mode_en [0] r/w r/clear set dma mode.if the run_ob has been wrtten as 0 and epn_dma_ttc_n reaches 0, dma_mode_en bit will be cleared by usb. 0 = interrupt mode 1 = dma mode 0
S3C2440a risc microprocessor usb device 13- 19 dma unit counter register (epn_dma_unit) this register is valid in demand mode. in other modes, this register value must be set to ?0x01? register address r/w description reset value ep1_dma_unit 0x52000204(l) 0x52000207(b) r/w (byte) ep1 dma transfer unit counter base register 0x00 ep2_dma_unit 0x5200021c(l) 0x5200021f(b) r/w (byte) ep2 dma transfer unit counter base register 0x00 ep3_dma_unit 0x52000244(l) 0x52000247(b) r/w (byte) ep3 dma transfer unit counter base register 0x00 ep4_dma_unit 0x5200025c(l) 0x5200025f(b) r/w (byte) ep4 dma transfer unit counter base register 0x00 dma_unit bit mcu usb description initial state epn_unit_cnt [7:0] r/w r ep dma transfer unit counter value 0x00
usb device S3C2440 a risc microprocessor 13- 20 dma fifo counter register (epn_dma_fifo) this register has values in byte size in fifo to be transferred by dma. in case of out_dma_run enabled, the value in out fifo write count register1 will be loaded in this register automatically. in case of in dma mode, the mcu should set proper value by software. register address r/w description reset value ep1_dma_fifo 0x52000208(l) 0x5200020b(b) r/w (byte) ep1 dma transfer fifo counter base register 0x00 ep2_dma_fifo 0x52000220(l) 0x52000223(b) r/w (byte) ep2 dma transfer fifo counter base register 0x00 ep3_dma_fifo 0x52000248(l) 0x5200024b(b) r/w (byte) ep3 dma transfer fifo counter base register 0x00 ep4_dma_fifo 0x52000260(l) 0x52000263(b) r/w (byte) ep4 dma transfer fifo counter base register 0x00 dma_fifo bit mcu usb description initial state epn_fifo_cnt [7:0] r/w r ep dma transfer fifo counter value 0x00
S3C2440a risc microprocessor usb device 13- 21 dma total transfer counter register (epn_dma_ttc_l,m,h) this register should have total number of bytes to be transferred using dma (total 20-bit counter). register address r/w description reset value ep1_dma_ttc_l 0x5200020c(l) 0x5200020f(b) r/w (byte) ep1 dma total transfer counter (lower byte) 0x00 ep1_dma_ttc_m 0x52000210(l) 0x52000213(b) r/w (byte) ep1 dma total transfer counter (middle byte) 0x00 ep1_dma_ttc_h 0x52000214(l) 0x52000217(b) r/w (byte) ep1 dma total transfer counter (higher byte) 0x00 ep2_dma_ttc_l 0x52000224(l) 0x52000227(b) r/w (byte) ep2 dma total transfer counter (lower byte) 0x00 ep2_dma_ttc_m 0x52000228(l) 0x5200022b(b) r/w (byte) ep2 dma total transfer counter (middle byte) 0x00 ep2_dma_ttc_h 0x5200022c(l) 0x5200022f(b) r/w (byte) ep2 dma total transfer counter (higher byte) 0x00 ep3_dma_ttc_l 0x5200024c(l) 0x5200024f(b) r/w (byte) ep3 dma total transfer counter (lower byte) 0x00 ep3_dma_ttc_m 0x52000250(l) 0x52000253(b) r/w (byte) ep3 dma total transfer counter (middle byte) 0x00 ep3_dma_ttc_h 0x52000254(l) 0x52000257(b) r/w (byte) ep3 dma total transfer counter (higher byte) 0x00 ep4_dma_ttc_l 0x52000264(l) 0x52000267(b) r/w (byte) ep4 dma total transfer counter (lower byte) 0x00 ep4_dma_ttc_m 0x52000268(l) 0x5200026b(b) r/w (byte) ep4 dma total transfer counter (middle byte) 0x00 ep4_dma_ttc_h 0x5200026c(l) 0x5200026f(b) r/w (byte) ep4 dma total transfer counter (higher byte) 0x00 dma_tx bit mcu usb description initial state epn_ttc_l [7:0] r/w r dma total transfer count value (lower byte) 0x00 epn_ttc_m [7:0] r/w r dma total transfer count value (middle byte) 0x00 epn_ttc_h [3:0] r/w r dma total transfer count value (higher byte) 0x00
usb device S3C2440 a risc microprocessor 13- 22 notes
S3C2440a risc microprocessor interrupt controller 14- 1 14 interrupt controller overview the interrupt controller in the S3C2440a receives the request from 60 interrupt sources. these interrupt sources are provided by internal peripherals such as dma controller, uart, iic, and others. in these interrupt sources, the uartn, ac97 and eintn interrupts are 'or'ed to the interrupt controller. when receiving multiple interrupt requests from internal peripherals and external interrupt request pins, the interrupt controller requests fiq or irq interrupt of the arm920t core after the arbitration procedure. the arbitration procedure depends on the hardware priority logic and the result is written to the interrupt pending register, which helps users notify which interrupt is generated out of various interrupt sources. request sources (with sub -register) request sources (without sub -register) srcpnd mask mode priority intpnd irq fiq subsrcpnd submask lcd interrupt has different features. please see the chapter 15 lcd controller figure 14-1. interrupt process diagram
interrupt controller S3C2440a risc mic roprocessor 14- 2 interrupt controller operation f-bit and i-bit of program status register (psr) if the f-bit of psr in arm920t cpu is set to 1, the cpu does not accept the fast interrupt request (fiq) from the interrupt controller. likewise, if i-bit of the psr is set to 1, the cpu does not accept the interrupt request (irq) from the interrupt controller. so, the interrupt controller can receive interrupts by clearing f-bit or i-bit of the psr to 0 and setting the corresponding bit of intmsk to 0. interrupt mode the arm920t has two types of interrupt mode: fiq or irq. all the interrupt sources determine which mode is used at interrupt request. interrupt pending register the S3C2440a has two interrupt pending registers: source pending register (srcpnd) and interrupt pending register (intpnd). these pending registers indicate whether an interrupt request is pending or not. when the interrupt sources request interrupt the service, the corresponding bits of srcpnd register are set to 1, and at the same time, only one bit of the intpnd register is set to 1 automatically after arbitration procedure. if interrupts are masked, then the corresponding bits of the srcpnd register are set to 1. this does not cause the bit of intpnd register changed. when a pending bit of intpnd register is set, the interrupt service routine will start whenever the i-flag or f-flag is cleared to 0. the srcpnd and intpnd registers can be read and written, so the service routine must clear the pending condition by writing a 1 to the corresponding bit in the srcpnd register first and then clear the pending condition in the intpnd registers by using the same method. interrupt mask register this register indicates that an interrupt has been disabled if the corresponding mask bit is set to 1. if an interrupt mask bit of intmsk is 0, the interrupt will be serviced normally. if the corresponding mask bit is 1 and the interrupt is generated, the source pending bit will be set.
S3C2440a risc microprocessor interrupt controller 14- 3 interrupt sources the interrupt controller supports 60 interrupt sources as shown in the table below. sources descriptions arbiter group int_adc adc eoc and touch interrupt (int_adc_s/int_tc) arb5 int_rtc rtc alarm interrupt arb5 int_spi1 spi1 interrupt arb5 int_uart0 uart0 interrupt (err, rxd, and txd) arb5 int_iic iic interrupt arb4 int_usbh usb host interrupt arb4 int_usbd usb device interrupt arb4 int_nfcon nand flash control interrupt arb4 int_uart1 uart1 interrupt (err, rxd, and txd) arb4 int_spi0 spi0 interrupt arb4 int_sdi sdi interrupt arb 3 int_dma3 dma channel 3 interrupt arb3 int_dma2 dma channel 2 interrupt arb3 int_dma1 dma channel 1 interrupt arb3 int_dma0 dma channel 0 interrupt arb3 int_lcd lcd interrupt (int_frsyn and int_ficnt) arb3 int_uart2 uart2 interrupt (err, rxd, and txd) arb2 int_timer4 timer4 interrupt arb2 int_timer3 timer3 interrupt arb2 int_timer2 timer2 interrupt arb2 int_timer1 timer1 interrupt arb 2 int_timer0 timer0 interrupt arb2 int_wdt_ac97 watch-dog timer interrupt(int_wdt, int_ac97) arb1 int_tick rtc time tick interrupt arb1 nbatt_flt battery fault interrupt arb1 int_cam camera interface (int_cam_c, int_cam_p) arb1 eint8_23 external interrupt 8 ? 23 arb1 eint4_7 external interrupt 4 ? 7 arb1 eint3 external interrupt 3 arb0 eint2 external interrupt 2 arb0 eint1 external interrupt 1 arb0 eint0 external interrupt 0 arb0
interrupt controller S3C2440a risc mic roprocessor 14- 4 interrupt sub sources sub sources descriptions source int_ac97 ac97 interrupt int_wdt_ac97 int_wdt watchdoc interrupt int_wdt_ac97 int_cam_p p-port capture interrupt in camera interface int_cam int_cam_c c-port capture interrupt in camera interface int_cam int_adc_s adc interrupt int_adc int_tc touch screen interrupt (pen up/down) int_adc int_err2 uart2 error interrupt int_uart2 int_txd2 uart2 transmit interrupt int_uart2 int_rxd2 uart2 receive interrupt int_uart2 int_err1 uart1 error interrupt int_uart1 int_txd1 uart1 transmit interrupt int_uart1 int_rxd1 uart1 receive interrupt int_uart1 int_err0 uart0 error interrupt int_uart0 int_txd0 uart0 transmit interrupt int_uart0 int_rxd0 uart0 receive interrupt int_uart0
S3C2440a risc microprocessor interrupt controller 14- 5 interrupt priority generating block the priority logic for 32 interrupt requests is composed of seven rotation based arbiters: six first-level arbiters and one second-level arbiter as shown in figure 14-1 below. arbiter6 arbiter0 arm irq req1/eint0 arbiter1 arbiter2 arbiter3 arbiter4 arbiter5 req4/int_tick req5/int_wdt/ac97 req0/int_timer0 req3/int_timer3 req2/int_timer2 req1/int_timer1 req4/int_timer4 req0/int_lcd req1/int_dma0 req3/int_dma2 req2/int_dma1 req5/int_uart2 req4/int_dma3 req5/int_sdi req0/int_spi0 req1/int_uart1 req2/int_nfcon req3/int_usbd req4/int_usbh req5/int_iic req1/int_uart0 req2/int_spi1 req3/int_rtc req4/int_adc req0 req1 req2 req3 req4 req5 req2/eint1 req3/eint2 req4/eint3 req0/eint4_7 req1/eint8_23 req2/int_cam req3/nbatt_flt figure 14-2. priority generating block
interrupt controller S3C2440a risc mic roprocessor 14- 6 interrupt priority each arbiter can handle six interrupt requests based on the one bit arbiter mode control (arb_mode) and two bits of selection control signals (arb_sel) as follows: ? if arb_sel bits are 00b, the priority order is req0, req1, req2, req3, req4, and req5. ? if arb_sel bits are 01b, the priority order is req0, req2, req3, req4, req1, and req5. ? if arb_sel bits are 10b, the priority order is req0, req3, req4, req1, req2, and req5. ? if arb_sel bits are 11b, the priority order is req0, req4, req1, req2, req3, and req5. note that req0 of an arbiter always has the highest priority, and req5 has the lowest one. in addition, by changing the arb_sel bits, we can rotate the priority of req1 to req4. here, if arb_mode bit is set to 0, arb_sel bits doesn?t change automatically changed, making the arbiter to operate in the fixed priority mode (note that even in this mode, we can reconfigure the priority by manually changing the arb_sel bits). on the other hand, if arb_mode bit is 1, arb_sel bits are changed in rotation fashion, e.g., if req1 is serviced, arb_sel bits are changed to 01b automatically so as to put req1 into the lowest priority. the detailed rules of arb_sel change are as follows: ? if req0 or req5 is serviced, arb_sel bits are not changed at all. ? if req1 is serviced, arb_sel bits are changed to 01b. ? if req2 is serviced, arb_sel bits are changed to 10b. ? if req3 is serviced, arb_sel bits are changed to 11b. ? if req4 is serviced, arb_sel bits are changed to 00b.
S3C2440a risc microprocessor interrupt controller 14- 7 interrupt controller special registers there are five control registers in the interrupt controller: source pending register, interrupt mode register, mask register, priority register, and interrupt pending register. all the interrupt requests from the interrupt sources are first registered in the source pending register. they are divided into two groups including fast interrupt request (fiq) and interrupt request (irq), based on the interrupt mode register. the arbitration procedure for multiple irqs is based on the priority register. source pending (srcpnd) register the srcpnd register is composed of 32 bits each of which is related to an interrupt source. each bit is set to 1 if the corresponding interrupt source generates the interrupt request and waits for the interrupt to be serviced. accordingly, this register indicates which interrupt source is waiting for the request to be serviced. note that each bit of the srcpnd register is automatically set by the interrupt sources regardless of the masking bits in the intmask register. in addition, the srcpnd register is not affected by the priority logic of interrupt controller. in the interrupt service routine for a specific interrupt source, the corresponding bit of the srcpnd register has to be cleared to get the interrupt request from the same source correctly. if you return from the isr without clearing the bit, the interrupt controller operates as if another interrupt request came in from the same source. in other words, if a specific bit of the srcpnd register is set to 1, it is always considered as a valid interrupt request waiting to be serviced. the time to clear the corresponding bit depends on the user's requirement. if you want to receive another valid request from the same source, you should clear the corresponding bit first, and then enable the interrupt. you can clear a specific bit of the srcpnd register by writing a data to this register. it clears only the bit positions of the srcpnd corresponding to those set to one in the data. the bit positions corresponding to those that are set to 0 in the data remains as they are. register address r/w description reset value srcpnd 0x4a000000 r/w indicate the interrupt request status. 0 = the interrupt has not been requested. 1 = the interrupt source has asserted the interrupt request. 0x00000000
interrupt controller S3C2440a risc mic roprocessor 14- 8 source pending (srcpnd) register ( continued ) srcpnd bit description initial state int_adc [31] 0 = not requested, 1 = requested 0 int_rtc [30] 0 = not requested, 1 = requested 0 int_spi1 [29] 0 = not requested, 1 = requested 0 int_uart0 [28] 0 = not requested, 1 = requested 0 int_iic [27] 0 = not requested, 1 = requested 0 int_usbh [26] 0 = not requested, 1 = requested 0 int_usbd [25] 0 = not requested, 1 = requested 0 int_nfcon [24] 0 = not requested, 1 = requested 0 int_uart1 [23] 0 = not requested, 1 = requested 0 int_spi0 [22] 0 = not requested, 1 = requested 0 int_sdi [21] 0 = not requested, 1 = requested 0 int_dma3 [20] 0 = not requested, 1 = requested 0 int_dma2 [19] 0 = not requested, 1 = requested 0 int_dma1 [18] 0 = not requested, 1 = requested 0 int_dma0 [17] 0 = not requested, 1 = requested 0 int_lcd [16] 0 = not requested, 1 = requested 0 int_uart2 [15] 0 = not requested, 1 = requested 0 int_timer4 [14] 0 = not requested, 1 = requested 0 int_timer3 [13] 0 = not requested, 1 = requested 0 int_timer2 [12] 0 = not requested, 1 = requested 0 int_timer1 [11] 0 = not requested, 1 = requested 0 int_timer0 [10] 0 = not requested, 1 = requested 0 int_wdt_ac97 [9] 0 = not requested, 1 = requested 0 int_tick [8] 0 = not requested, 1 = requested 0 nbatt_flt [7] 0 = not requested, 1 = requested 0 int_cam [6] 0 = not requested, 1 = requested 0 eint8_23 [5] 0 = not requested, 1 = requested 0 eint4_7 [4] 0 = not requested, 1 = requested 0 eint3 [3] 0 = not requested, 1 = requested 0 eint2 [2] 0 = not requested, 1 = requested 0 eint1 [1] 0 = not requested, 1 = requested 0 eint0 [0] 0 = not requested, 1 = requested 0 .
S3C2440a risc microprocessor interrupt controller 14- 9 interrupt mode (intmod) register this register is composed of 32 bits each of which is related to an interrupt source. if a specific bit is set to 1, the corresponding interrupt is processed in the fiq (fast interrupt) mode. otherwise, it is processed in the irq mode (normal interrupt). please note that only one interrupt source can be serviced in the fiq mode in the interrupt controller (you should use the fiq mode only for the urgent interrupt). thus, only one bit of intmod can be set to 1. register address r/w description reset value intmod 0x4a000004 r/w interrupt mode register. 0 = irq mode 1 = fiq mode 0x00000000 note: if an interrupt mode is set to fiq mode in the intmod register, fiq interrupt will not affect both intpnd and intoffset registers. in this case, the two registers are valid only for irq mode interrupt source.
interrupt controller S3C2440a risc mic roprocessor 14- 10 interrupt mode (intmod) register ( continued ) intmod bit description initial state int_adc [31] 0 = irq, 1 = fiq 0 int_rtc [30] 0 = irq, 1 = fiq 0 int_spi1 [29] 0 = irq, 1 = fiq 0 int_uart0 [28] 0 = irq, 1 = fiq 0 int_iic [27] 0 = irq, 1 = fiq 0 int_usbh [26] 0 = irq, 1 = fiq 0 int_usbd [25] 0 = irq, 1 = fiq 0 int_nfcon [24] 0 = irq, 1 = fiq 0 int_urrt1 [23] 0 = irq, 1 = fiq 0 int_spi0 [22] 0 = irq, 1 = fiq 0 int_sdi [21] 0 = irq, 1 = fiq 0 int_dma3 [20] 0 = irq, 1 = fiq 0 int_dma2 [19] 0 = irq, 1 = fiq 0 int_dma1 [18] 0 = irq, 1 = fiq 0 int_dma0 [17] 0 = irq, 1 = fiq 0 int_lcd [16] 0 = irq, 1 = fiq 0 int_uart2 [15] 0 = irq, 1 = fiq 0 int_timer4 [14] 0 = irq, 1 = fiq 0 int_timer3 [13] 0 = irq, 1 = fiq 0 int_timer2 [12] 0 = irq, 1 = fiq 0 int_timer1 [11] 0 = irq, 1 = fiq 0 int_timer0 [10] 0 = irq, 1 = fiq 0 int_wdt_ac97 [9] 0 = irq, 1 = fiq 0 int_tick [8] 0 = irq, 1 = fiq 0 nbatt_flt [7] 0 = irq, 1 = fiq 0 int_cam [6] 0 = irq, 1 = fiq 0 eint8_23 [5] 0 = irq, 1 = fiq 0 eint4_7 [4] 0 = irq, 1 = fiq 0 eint3 [3] 0 = irq, 1 = fiq 0 eint2 [2] 0 = irq, 1 = fiq 0 eint1 [1] 0 = irq, 1 = fiq 0 eint0 [0] 0 = irq, 1 = fiq 0
S3C2440a risc microprocessor interrupt controller 14- 11 interrupt mask (intmsk) register this register also has 32 bits each of which is related to an interrupt source. if a specific bit is set to 1, the cpu does not service the interrupt request from the corresponding interrupt source (note that even in such a case, the corresponding bit of srcpnd register is set to 1). if the mask bit is 0, the interrupt request can be serviced. register address r/w description reset value intmsk 0x4a000008 r/w determine which interrupt source is masked. the masked interrupt source will not be serviced. 0 = interrupt service is available. 1 = interrupt service is masked. 0xffffffff
interrupt controller S3C2440a risc mic roprocessor 14- 12 interrupt mask (intmsk) register ( continued ) intmsk bit description initial state int_adc [31] 0 = service available, 1 = masked 1 int_rtc [30] 0 = service available, 1 = masked 1 int_spi1 [29] 0 = service available, 1 = masked 1 int_uart0 [28] 0 = service available, 1 = masked 1 int_iic [27] 0 = service available, 1 = masked 1 int_usbh [26] 0 = service available, 1 = masked 1 int_usbd [25] 0 = service available, 1 = masked 1 int_nfcon [24] 0 = service available, 1 = masked 1 int_uart1 [23] 0 = service available, 1 = masked 1 int_spi0 [22] 0 = service available, 1 = masked 1 int_sdi [21] 0 = service available, 1 = masked 1 int_dma3 [20] 0 = service available, 1 = masked 1 int_dma2 [19] 0 = service available, 1 = masked 1 int_dma1 [18] 0 = service available, 1 = masked 1 int_dma0 [17] 0 = service available, 1 = masked 1 int_lcd [16] 0 = service available, 1 = masked 1 int_uart2 [15] 0 = service available, 1 = masked 1 int_timer4 [14] 0 = service available, 1 = masked 1 int_timer3 [13] 0 = service available, 1 = masked 1 int_timer2 [12] 0 = service available, 1 = masked 1 int_timer1 [11] 0 = service available, 1 = masked 1 int_timer0 [10] 0 = service available, 1 = masked 1 int_wdt_ac97 [9] 0 = service available, 1 = masked 1 int_tick [8] 0 = service available, 1 = masked 1 nbatt_flt [7] 0 = service available, 1 = masked 1 int_cam [6] 0 = service available, 1 = masked 1 eint8_23 [5] 0 = service available, 1 = masked 1 eint4_7 [4] 0 = service available, 1 = masked 1 eint3 [3] 0 = service available, 1 = masked 1 eint2 [2] 0 = service available, 1 = masked 1 eint1 [1] 0 = service available, 1 = masked 1 eint0 [0] 0 = service available, 1 = masked 1
S3C2440a risc microprocessor interrupt controller 14- 13 priority register (priority) register address r/w description reset value priority 0x4a00000c r/w irq priority control register 0x7f priority bit description initial state arb_sel6 [20:19] arbiter 6 group priority order set 00 = req 0-1-2-3-4-5 01 = req 0-2-3-4-1-5 10 = req 0-3-4-1-2-5 11 = req 0-4-1-2-3-5 00 arb_sel5 [18:17] arbiter 5 group priority order set 00 = req 1-2-3-4 01 = req 2-3-4-1 10 = req 3-4-1-2 11 = req 4-1-2-3 00 arb_sel4 [16:15] arbiter 4 group priority order set 00 = req 0-1-2-3-4-5 01 = req 0-2-3-4-1-5 10 = req 0-3-4-1-2-5 11 = req 0-4-1-2-3-5 00 arb_sel3 [14:13] arbiter 3 group priority order set 00 = req 0-1-2-3-4-5 01 = req 0-2-3-4-1-5 10 = req 0-3-4-1-2-5 11 = req 0-4-1-2-3-5 00 arb_sel2 [12:11] arbiter 2 group priority order set 00 = req 0-1-2-3-4-5 01 = req 0-2-3-4-1-5 10 = req 0-3-4-1-2-5 11 = req 0-4-1-2-3-5 00 arb_sel1 [10:9] arbiter 1 group priority order set 00 = req 0-1-2-3-4-5 01 = req 0-2-3-4-1-5 10 = req 0-3-4-1-2-5 11 = req 0-4-1-2-3-5 00 arb_sel0 [8:7] arbiter 0 group priority order set 00 = req 1-2-3-4 01 = req 2-3-4-1 10 = req 3-4-1-2 11 = req 4-1-2-3 00 arb_mode6 [6] arbiter 6 group priority rotate enable 0 = priority does not rotate, 1 = priority rotate enable 1 arb_mode5 [5] arbiter 5 group priority rotate enable 0 = priority does not rotate, 1 = priority rotate enable 1 arb_mode4 [4] arbiter 4 group priority rotate enable 0 = priority does not rotate, 1 = priority rotate enable 1 arb_mode3 [3] arbiter 3 group priority rotate enable 0 = priority does not rotate, 1 = priority rotate enable 1 arb_mode2 [2] arbiter 2 group priority rotate enable 0 = priority does not rotate, 1 = priority rotate enable 1 arb_mode1 [1] arbiter 1 group priority rotate enable 0 = priority does not rotate, 1 = priority rotate enable 1 arb_mode0 [0] arbiter 0 group priority rotate enable 0 = priority does not rotate, 1 = priority rotate enable 1
interrupt controller S3C2440a risc mic roprocessor 14- 14 interrupt pending (intpnd) register each of the 32 bits in the interrupt pending register shows whether the corresponding interrupt request, which is unmasked and waits for the interrupt to be serviced, has the highest priority . since the intpnd register is located after the priority logic, only one bit can be set to 1, and that interrupt request generates irq to cpu. in interrupt service routine for irq, you can read this register to determine which interrupt source is serviced among the 32 sources. like the srcpnd register, this register has to be cleared in the interrupt service routine after clearing the srcpnd register. we can clear a specific bit of the intpnd register by writing a data to this register. it clears only the bit positions of the intpnd register corresponding to those set to one in the data. the bit positions corresponding to those that are set to 0 in the data remains as they are. register address r/w description reset value intpnd 0x4a000010 r/w indicate the interrupt request status. 0 = the interrupt has not been requested. 1 = the interrupt source has asserted the interrupt request. 0x00000000 note: if the fiq mode interrupt occurs, the corresponding bit of intpnd will not be turned on as the intpnd register is available only for irq mode interrupt.
S3C2440a risc microprocessor interrupt controller 14- 15 interrupt pending (intpnd) register ( continued ) intpnd bit description initial state int_adc [31] 0 = not requested, 1 = requested 0 int_rtc [30] 0 = not requested, 1 = requested 0 int_spi1 [29] 0 = not requested, 1 = requested 0 int_uart0 [28] 0 = not requested, 1 = requested 0 int_iic [27] 0 = not requested, 1 = requested 0 int_usbh [26] 0 = not requested, 1 = requested 0 int_usbd [25] 0 = not requested, 1 = requested 0 int_nfcon [24] 0 = not requested, 1 = requested 0 int_uart1 [23] 0 = not requested, 1 = requested 0 int_spi0 [22] 0 = not requested, 1 = requested 0 int_sdi [21] 0 = not requested, 1 = requested 0 int_dma3 [20] 0 = not requested, 1 = requested 0 int_dma2 [19] 0 = not requested, 1 = requested 0 int_dma1 [18] 0 = not requested, 1 = requested 0 int_dma0 [17] 0 = not requested, 1 = requested 0 int_lcd [16] 0 = not requested, 1 = requested 0 int_uart2 [15] 0 = not requested, 1 = requested 0 int_timer4 [14] 0 = not requested, 1 = requested 0 int_timer3 [13] 0 = not requested, 1 = requested 0 int_timer2 [12] 0 = not requested, 1 = requested 0 int_timer1 [11] 0 = not requested, 1 = requested 0 int_timer0 [10] 0 = not requested, 1 = requested 0 int_wdt_ac97 [9] 0 = not requested, 1 = requested 0 int_tick [8] 0 = not requested, 1 = requested 0 nbatt_flt [7] 0 = not requested, 1 = requested 0 int_cam [6] 0 = not requested, 1 = requested 0 eint8_23 [5] 0 = not requested, 1 = requested 0 eint4_7 [4] 0 = not requested, 1 = requested 0 eint3 [3] 0 = not requested, 1 = requested 0 eint2 [2] 0 = not requested, 1 = requested 0 eint1 [1] 0 = not requested, 1 = requested 0 eint0 [0] 0 = not requested, 1 = requested 0
interrupt controller S3C2440a risc mic roprocessor 14- 16 interrupt offset (intoffset) register the value in the interrupt offset register shows which interrupt request of irq mode is in the intpnd register. this bit can be cleared automatically by clearing srcpnd and intpnd. register address r/w description reset value intoffset 0x4a000014 r indicate the irq interrupt request source 0x00000000 int source the offset value int source the offset value int_adc 31 int_uart2 15 int_rtc 30 int_timer4 14 int_spi1 29 int_timer3 13 int_uart0 28 int_timer2 12 int_iic 27 int_timer1 11 int_usbh 26 int_timer0 10 int_usbd 25 int_wdt_ac97 9 int_nfcon 24 int_tick 8 int_uart1 23 nbatt_flt 7 int_spi0 22 int_cam 6 int_sdi 21 eint8_23 5 int_dma3 20 eint4_7 4 int_dma2 19 eint3 3 int_dma1 18 eint2 2 int_dma0 17 eint1 1 int_lcd 16 eint0 0 note: fiq mode interrupt does not affect the intoffset register as the register is available only for irq mode interrupt.
S3C2440a risc microprocessor interrupt controller 14- 17 sub source pending (subsrcpnd) register you can clear a specific bit of the subsrcpnd register by writing a data to this register. it clears only the bit positions of the subsrcpnd register corresponding to those set to one in the data. the bit positions corresponding to those that are set to 0 in the data remains as they are. register address r/w description reset value subsrcpnd 0x4a000018 r/w indicate the interrupt request status. 0 = the interrupt has not been requested. 1 = the interrupt source has asserted the interrupt request. 0x00000000 subsrcpnd bit description initial state reserved [31:15] not used 0 int_ac97 [14] 0 = not requested, 1 = requested 0 int_wdt [13] 0 = not requested, 1 = requested 0 int_cam_p [12] 0 = not requested, 1 = requested 0 int_cam_c [11] 0 = not requested, 1 = requested 0 int_adc_s [10] 0 = not requested, 1 = requested 0 int_tc [9] 0 = not requested, 1 = requested 0 int_err2 [8] 0 = not requested, 1 = requested 0 int_txd2 [7] 0 = not requested, 1 = requested 0 int_rxd2 [6] 0 = not requested, 1 = requested 0 int_err1 [5] 0 = not requested, 1 = requested 0 int_txd1 [4] 0 = not requested, 1 = requested 0 int_rxd1 [3] 0 = not requested, 1 = requested 0 int_err0 [2] 0 = not requested, 1 = requested 0 int_txd0 [1] 0 = not requested, 1 = requested 0 int_rxd0 [0] 0 = not requested, 1 = requested 0 map to srcpnd srcpnd subsrcpnd remark int_uart0 int_rxd0,int_txd0,int_err0 int_uart1 int_rxd1,int_txd1,int_err1 int_uart2 int_rxd2,int_txd2,int_err2 int_adc int_adc_s, int_tc int_cam int_cam_c, int_cam_p int_wdt_ac97 int_wdt, int_ac97
interrupt controller S3C2440a risc mic roprocessor 14- 18 interrupt sub mask (intsubmsk) register this register has 11 bits each of which is related to an interrupt source. if a specific bit is set to 1, the interrupt request from the corresponding interrupt source is not serviced by the cpu (note that even in such a case, the corresponding bit of the subsrcpnd register is set to 1). if the mask bit is 0, the interrupt request can be serviced. register address r/w description reset value intsubmsk 0x4a00001c r/w determine which interrupt source is masked. the masked interrupt source will not be serviced. 0 = interrupt service is available. 1 = interrupt service is masked. 0xffff intsubmsk bit description initial state reserved [31:15] not used 0 int_ac97 [14] 0 = service available, 1 = masked 1 int_wdt [13] 0 = service available, 1 = masked 1 int_cam_p [12] 0 = service available, 1 = masked 1 int_cam_c [11] 0 = service available, 1 = masked 1 int_adc_s [10] 0 = service available, 1 = masked 1 int_tc [9] 0 = service available, 1 = masked 1 int_err2 [8] 0 = service available, 1 = masked 1 int_txd2 [7] 0 = service available, 1 = masked 1 int_rxd2 [6] 0 = service available, 1 = masked 1 int_err1 [5] 0 = service available, 1 = masked 1 int_txd1 [4] 0 = service available, 1 = masked 1 int_rxd1 [3] 0 = service available, 1 = masked 1 int_err0 [2] 0 = service available, 1 = masked 1 int_txd0 [1] 0 = service available, 1 = masked 1 int_rxd0 [0] 0 = service available, 1 = masked 1
S3C2440a risc microprocessor lcd controller 15- 1 15 lcd controller overview the lcd controller in the S3C2440a consists of the logic for transferring lcd image data from a video buffer located in system memory to an external lcd driver. the lcd controller supports monochrome, 2-bit per pixel (4-level gray scale) or 4-bit per pixel (16-level gray scale) mode on a monochrome lcd, using a time-based dithering algorithm and frame rate control (frc) method and it can be interfaced with a color lcd panel at 8-bit per pixel (256-level color) and 12-bit per pixel (4096-level color) for interfacing with stn lcd. it can support 1-bit per pixel, 2-bit per pixel, 4-bit per pixel, and 8-bit per pixel for interfacing with the palletized tft color lcd panel, and 16-bit per pixel and 24-bit per pixel for non-palletized true-color display. the lcd controller can be programmed to support different requirements on the screen related to the number of horizontal and vertical pixels, data line width for the data interface, interface timing, and refresh rate. features stn lcd displays: ? supports 3 types of lcd panels: 4-bit dual scan, 4-bit single scan, and 8-bit single scan display type ? supports the monochrome, 4 gray levels, and 16 gray levels ? supports 256 colors and 4096 colors for color stn lcd panel ? supports multipl e screen size typical actual screen size: 640 x 480, 320 x 240, 160 x 160, and others maximum virtual screen size is 4mbytes. maximum virtual screen size in 256 color mode: 4096 x 1024, 2048 x 2048, 1024 x 4096, and others tft lcd displays: ? supports 1, 2, 4 or 8-bpp (bit per pixel) palletized color displays for tft ? supports 16, 24-bpp non-palletized true-color displays for color tft ? supports maximum 16m color tft at 24bit per pixel mode ? supports multiple screen size typical actual screen size: 640 x 480, 320 x 240, 160 x 160, and others maximum virtual screen size is 4mbytes. maximum virtual screen size in 64k color mode: 2048 x 1024 and others
lcd controller s3 c2440a risc microprocessor 15- 2 common features the lcd controller has a dedicated dma that supports to fetch the image data from video buffer located in system memory. its features also include: ? dedicated interrupt functions (int_frsyn and int_ficnt) ? the system memory is used as the display memory. ? supports multiple virtual display screen (supports hardware horizontal/vertical scro lling) ? programmable timing control for different display panels ? supports little and big-endian byte ordering, as well as wince data formats ? supports 2-type sec tft lcd panel (samsung 3.5? portrait / 256k color /reflective and transflective a-si tft lcd) lts350q1-pd1: tft lcd panel with touch panel and front light unit (reflective type) lts350q1-pd2: tft lcd panel only lts350q1-pe1: tft lcd panel with touch panel and front light unit (transflective type) lts350q1-pe2: tft lcd panel only note win ce doesn?t support the 12-bit packed data format. please check if wince can support the 12-bit color-mode. external interface signal stn tft sec tft (lts350q1-pd1/2) sec tft (lts350q1-pe1/2) vframe (frame sync. signal) vsync (vertical sync. signal) stv stv vline (line sync pulse signal) hsync (horizontal sync. signal) cpv cpv vclk (pixel clock signal) vclk (pixel clock signal) lcd_hclk lcd_hclk vd[23:0] (lcd pixel data output ports) vd[23:0] (lcd pixel data output ports) vd[23:0] vd[23:0] vm (ac bias signal for lcd driver) vden (data enable signal) tp tp ? lend (line end signal) sth sth lcd_pwren lcd_pwren lcd_pwren lcd_pwren ? ? lpc_oe lcc_inv ? ? lpc_rev lcc_rev ? ? lpc_revb lcc_revb
S3C2440a risc microprocessor lcd controller 15- 3 block diagram system bus lpc3600 is a timing control logic unit for lts350q1-pd1 or lts350q1-pd2. lcc3600 is a timing control logic unit for lts350q1-pe1 or lts350q1-pe2. regbank lcdcdma vidprcs lpc3600 timegen vd[23:0] vclk /lcd_hclk vline / hsync / cpv vframe / vsync / stv vm / vden / tp lcd_lpcoe / lcd_lccinv lcd_lpcrev / lcd_lccrev lcd_lpcrevb / lcd_lccrevb . . . video mux lcc3600 figure 15-1. lcd controller block diagram the S3C2440a lcd controller is used to transfer the video data and to generate the necessary control signals, such as vframe, vline, vclk, vm, and so on. in addition to the control signals, the S3C2440a has the data ports for video data, which are vd[23:0] as shown in figure 15-1. the lcd controller consists of a regbank, lcdcdma, vidprcs, timegen , and lpc3600 (see the figure 15-1 lcd controller block diagram). the regbank has 17 programmable register sets and 256x16 palette memory which are used to configure the lcd controller. the lcdcdma is a dedicated dma, which can transfer the video data in frame memory to lcd driver automatically. by using this special dma, the video data can be displayed on the screen without cpu intervention. the vidprcs receives the video data from the lcdcdma and sends the video data through the vd[23:0] data ports to the lcd driver after changing them into a suitable data format, for example 4/8-bit single scan or 4-bit dual scan display mode. the timegen consists of programmable logic to support the variable requirements of interface timing and rates commonly found in different lcd drivers. the timegen block generates vframe, vline, vclk, vm, and so on. the description of data flow is as follows: fifo memory is present in the lcdcdma. when fifo is empty or partially empty, the lcdcdma requests data fetching from the frame memory based on the burst memory transfer mode (consecutive memory fetching of 4 words (16 bytes) per one burst request without allowing the bus mastership to another bus master during the bus transfer). when the transfer request is accepted by bus arbitrator in the memory controller, there will be four successive word data transfers from system memory to internal fifo. the total size of fifo is 28 words, which consists of 12 words fifol and 16 words fifoh, respectively. the S3C2440a has two fifos to support the dual scan display mode. in case of single scan mode, one of the fifos (fifoh) can only be used.
lcd controller s3 c2440a risc microprocessor 15- 4 stn lcd controller operation timing generator (timegen) the timegen generates the control signals for the lcd driver, such as vframe, vline, vclk, and vm. these control signals are closely related to the configuration on the lcdcon1/2/3/4/5 registers in the regbank. based on these programmable configurations on the lcd control registers in the regbank, the timegen can generate the programmable control signals suitable to support many different types of lcd drivers. the vframe pulse is asserted for the duration of the entire first line at a frequency of once per frame. the vframe signal is asserted to bring the lcd's line pointer to the top of the display to start over. the vm signal helps the lcd driver alternate the polarity of the row and column voltages, which are used to turn the pixel on and off. the toggling rate of vm signals depends on the mmode bit of the lcdcon1 register and mval field of the lcdcon4 register. if the mmode bit is 0, the vm signal is configured to toggle on every frame. if the mmode bit is 1, the vm signal is configured to toggle on the every event of the elapse of the specified number of vline by the mval[7:0] value. figure 15-4 shows an example for mmode=0 and for mmode=1 with the value of mval[7:0]=0x2. when mmode=1, the vm rate is related to mval[7:0], as shown below: vm rate = vline rate / ( 2 x mval) the vframe and vline pulse generation relies on the configurations of the hozval field and the lineval field in the lcdcon2/3 registers. each field is related to the lcd size and display mode. in other words, the hozval and lineval can be determined by the size of the lcd panel and the display mode according to the following equation: hozval = (horizontal display size / number of the valid vd data line)-1 in color mode: horizontal display size = 3 x number of horizontal pixel in the 4-bit single scan display mode, the number of valid vd data line should be 4. in case of 4-bit dual scan display, the number of valid vd data lineshould also be 4 while in case of 8-bit single scan display mode, the number of valid vd data line should be 8. lineval = (vertical display size) -1: in case of single scan display type lineval = (vertical display size / 2) -1: in case of dual scan display type the rate of vclk signal depends on the configuration of the clkval field in the lcdcon1 register. table 15-1 defines the relationship of vclk and clkval. the minimum value of clkval is 2. vclk(hz)=hclk/(clkval x 2) the frame rate is the vfram signal frequency. the frame rate is closely related to the field of wlh[1:0](vline pulse width) wdly[1:0] (the delay width of vclk after vline pulse), hozval, lineblank, and lineval in the lcdcon1/2/3/4 registers as well as vclk and hclk. most lcd drivers need their own adequate frame rate. the frame rate is calculated as follows: frame_rate(hz) = 1 / [ { (1/vclk) x (hozval+1)+(1/hclk) x ( a + b +(lineblank x 8) ) } x ( lineval+1) ] a = 2 (4+wlh) , b = 2 (4+wdly)
S3C2440a risc microprocessor lcd controller 15- 5 table 15-1. relation between vclk and clkval (stn, hclk = 60mhz) clkval 60mhz/x vclk 2 60 mhz/4 15.0 mhz 3 60 mhz/6 10.0 mhz : : : 1023 60 mhz/2046 29.3 khz video operation the S3C2440a lcd controller supports 8-bit color mode (256 color mode), 12-bit color mode (4096 color mode), 4 level gray scale mode, 16 level gray scale mode as well as the monochrome mode. for the gray or color mode, it is required to implement the shades of gray level or color according to time-based dithering algorithm and frame rate control (frc) method. the selection can be made following a programmable lockup table, which will be explained later. the monochrome mode bypasses these modules (frc and lookup table) and basically serializes the data in fifoh (and fifol if a dual scan display type is used) into 4-bit (or 8-bit if a 4-bit dual scan or 8-bit single scan display type is used) streams by shifting the video data to the lcd driver. the following sections describe the operation on the gray and color mode in terms of the lookup table and frc. lookup table the S3C2440a can support the lookup table for various selection of color or gray level mapping, ensuring flexible operation for users. the lookup table is the palette which allows the selection on the level of color or gray (selection on 4-gray levels among 16 gray levels in case of 4 gray mode, selection on 8 red levels among 16 levels, 8 green levels among 16 levels and 4 blue levels among 16 levels in case of 256 color mode). in other words, users can select 4 gray levels among 16 gray levels by using the lookup table in the 4 gray level mode. the gray levels cannot be selected in the 16 gray level mode; all 16 gray levels must be chosen among the possible 16 gray levels. in case of 256 color mode, 3 bits are allocated for red, 3 bits for green and 2 bits for blue. the 256 colors mean that the colors are formed from the combination of 8 red, 8 green and 4 blue levels (8x8x4 = 256). in the color mode, the lookup table can be used for suitable selections. eight red levels can be selected among 16 possible red levels, 8 green levels among 16 green levels, and 4 blue levels among 16 blue levels. in case of 4096 color mode, there is no selection as in the 256 color mode. gray mode operation the S3C2440a lcd controller supports two gray modes : 2-bit per pixel gray (4 level gray scale) and 4-bit per pixel gray (16 level gray scale). the 2-bit per pixel gray mode uses a lookup table (bluelut) , which allows selection on 4 gray levels among 16 possible gray levels. the 2-bit per pixel gray lookup table uses the buleval[15:0] in blue lookup table (bluelut) register as same as blue lookup table in color mode. the gray level 0 will be denoted by blueval[3:0] value. if blueval[3:0] is 9, level 0 will be represented by gray level 9 among 16 gray levels. if blueval[3:0] is 15, level 0 will be represented by gray level 15 among 16 gray levels, and so on. following the same method as above, level 1 will also be denoted by blueval[7:4], the level 2 by blueval[11:8], and the level 3 by blueval[15:12]. these four groups among blueval[15:0] will represent level 0, level 1, level 2, and level 3. in 16 gray levels, there is no selection as in the 16 gray levels.
lcd controller s3 c2440a risc microprocessor 15- 6 256 level color mode operation the S3C2440a lcd controller can support an 8-bit per pixel 256 color display mode. the color display mode can generate 256 levels of color using the dithering algorithm and frc. the 8-bit per pixel are encoded into 3-bits for red, 3-bits for green, and 2-bits for blue. the color display mode uses separate lookup tables for red, green, and blue. each lookup table uses the redval[31:0] of redlut register, greenval[31:0] of greenlut register, and blueval[15:0] of bluelut register as the programmable lookup table entries. similar to the gray level display, 8 group or field of 4 bits in the redlur register, i.e., redval[31:28], redlut[27:24], redlut[23:20], redlut[19:16], redlut[15:12], redlut[11:8], redlut[7:4], and redlut[3:0], are assigned to each red level. the possible combination of 4 bits (each field) is 16, and each red level should be assigned to one level among possible 16 cases. in other words, the user can select the suitable red level by using this type of lookup table. for green color, the greenval[31:0] of the greenlut register is assigned as the lookup table, as was done in the case of red color. similarly, the blueval[15:0] of the bluelut register is also assigned as a lookup table. for blue color, 2 bits are allocated for 4 blue levels, different from the 8 red or green levels. 4096 level color mode operation the S3C2440a lcd controller can support a 12-bit per pixel 4096 color display mode. the color display mode can generate 4096 levels of color using the dithering algorithm and frc. the 12-bit per pixel are encoded into 4-bits for red, 4-bits for green, and 4-bits for blue. the 4096 color display mode does not use lookup tables.
S3C2440a risc microprocessor lcd controller 15- 7 dithering and frame rate control in case of stn lcd display (except monochrome), video data must be processed by a dithering algorithm. the dithfrc block has two functions, such as time-based dithering algorithm for reducing flicker and frame rate control (frc) for displaying gray and color level on the stn panel. the main principle of gray and color level display on the stn panel based on frc is described. for example, to display the third gray (3/16) level from a total of 16 levels, the 3 times pixel should be on and 13 times pixel off. in other words, 3 frames should be selected among the 16 frames, of which 3 frames should have a pixel-on on a specific pixel while the remaining 13 frames should have a pixel-off on a specific pixel. these 16 frames should be displayed periodically. this is basic principle on how to display the gray level on the screen, so-called gray level display by frc. the actual example is shown in table 15-2. to represent the 14 th gray level in the table, we should have a 6/7 duty cycle, which mean that there are 6 times pixel-on and one time pixel-off. the other cases for all gray levels are also shown in table 15-2. in the stn lcd display, we should be reminded of one item, i.e., flicker noise due to the simultaneous pixel-on and -off on adjacent frames. for example, if all pixels on first frame are turned on and all pixels on next frame are turned off, the flicker noise will be maximized. to reduce the flicker noise on the screen, the average probability of pixel- on and -off between frames should be the same. in order to realize this, the time-based dithering algorithm, which varies the pattern of adjacent pixels on every frame, should be used. this is explained in detail. for the 16 gray level, frc should have the following relationship between gray level and frc. the 15 th gray level should always have pixel- on, and the 14 th gray level should have 6 times pixel-on and one times pixel-off, and the 13 th gray level should have 4 times pixel-on and one times pixel-off, ,,,,,,,, , and the 0 th gray level should always have pixel-off as shown in table 15-2. table 15-2. dither duty cycle examples pre-dithered data (gray level number) duty cycle pre-dithered data (gray level number) duty cycle 15 1 7 1/2 14 6/7 6 3/7 13 4/5 5 2/5 12 3/4 4 1/3 11 5/7 3 1/4 10 2/3 2 1/5 9 3/5 1 1/7 8 4/7 0 0
lcd controller s3 c2440a risc microprocessor 15- 8 display types the lcd controller supports 3 types of lcd drivers: 4-bit dual scan, 4-bit single scan, and 8-bit single scan display mode. figure 15-2 shows these 3 different display types for monochrome displays, and figure 15-3 show these 3 different display types for color displays. 4-bit dual scan display type a 4-bit dual scan display uses 8 parallel data lines to shift data to both the upper and lower halves of the display at the same time. the 4 bits of data in the 8 parallel data lines are shifted to the upper half and 4 bits of data is shifted to the lower half, as shown in figure 15-2. the end of frame is reached when each half of the display has been shifted and transferred. the 8 pins (vd[7:0]) for the lcd output from the lcd controller can be directly connected to the lcd driver. 4-bit single scan display type a 4-bit single scan display uses 4 parallel data lines to shift data to successive single horizontal lines of the display at a time, until the entire frame has been shifted and transferred. the 4 pins (vd[3:0]) for the lcd output from the lcd controller can be directly connected to the lcd driver, and the 4 pins (vd[7:4]) for the lcd output are not used. 8-bit single scan display type an 8-bit single scan display uses 8 parallel data lines to shift data to successive single horizontal lines of the display at a time, until the entire frame has been shifted and transferred. the 8 pins (vd[7:0]) for the lcd output from the lcd controller can be directly connected to the lcd driver. 256 color displays color displays require 3 bits (red, green, and blue) of image data per pixel, so the number of horizontal shift registers for each horizontal line corresponds to three times the number of pixels of one horizontal line. these results in a horizontal shift register of length 3 times the number of pixels per horizontal line. this rgb is shifted to the lcd driver as consecutive bits via the parallel data lines. figure 15-3 shows the rgb and order of the pixels in the parallel data lines for the 3 types of color displays. 4096 color displays color displays require 3 bits (red, green, and blue) of image data per pixel, and so the number of horizontal shift registers for each horizontal line corresponds to three times the number of pixels of one horizontal line. this rgb is shifted to the lcd driver as consecutive bits via the parallel data lines. this rgb order is determined by the sequence of video data in video buffers.
S3C2440a risc microprocessor lcd controller 15- 9 memory data format (stn, bswp = 0) mono 4-bit dual scan display: video buffer memory: address data 0000h a[31:0] 0004h b[31:0] ? ? ? 1000h l[31:0] 1004h m[31:0] ? ? ? mono 4-bit single scan display & 8-bit single scan display: video buffer memory: address data 0000h a[31:0] 0004h b[31:0] 0008h c[31:0] ? ? ? lcd panel lcd panel a[31] a[30] ...... a[0] b[31] b[30] ...... b[0] ...... l[31] l[30] ...... l[0] m[31] m[30] ...... m[0] ...... a[31] a[30] a[29] ...... a[0] b[31] b[30] ...... b[0] c[31] ...... c[0] ......
lcd controller s3 c2440a risc microprocessor 15- 10 memory data format ( stn, bswp=0 ) (continued) in 4-level gray mode , 2 bits of video data correspond to 1 pixel. in 16-level gray mode , 4 bits of video data correspond to 1 pixel. in 256 level color mode , 8 bits (3 bits of red, 3 bits of green, and 2 bits of blue) of video data correspond to 1 pixel. the color data format in a byte is as follows: bit [ 7:5 ] bit [ 4:2 ] bit[1:0] red green blue in 4096 level color mode : packed 12 bpp color mode 12 bits (4 bits of red, 4 bits of green, 4 bits of blue) of video data correspond to 1 pixel. the following table shows color data format in words: (video data must reside at 3 word boundaries (8 pixel), as follows) rgb order data [31:28] [27:24] [23:20] [19:16] [15:12] [11:8] [7:4] [3:0] word #1 red( 1) green(1) blue( 1) red( 2) green( 2) blue( 2) red(3) green(3) word #2 blue(3) red(4) green(4) blue(4) red(5) green(5) blue(5) red(6) word #3 green(6) blue(6) red(7) green(7) blue(7) red(8) green(8) blue(8) unpacked 12 bpp color mode 12 bits (4 bits of red, 4 bits of green, 4 bits of blue) of video data correspond to 1 pixel. the following table shows color data format in words: rgb order data [31:28] [27:24] [23:20] [19:16] [15:12] [11:8] [7:4] [3:0] word #1 ? red( 1) green(1) blue( 1) ? red( 2) green( 2) blue( 2) word #2 ? red( 3) green(3) blue( 3) ? red( 4) green( 4) blue( 4) word #3 ? red( 5) green(5) blue( 5) ? red( 6) green( 6) blue( 6)
S3C2440a risc microprocessor lcd controller 15- 11 16 bpp color mode 16 bits (5 bits of red, 6 bits of green, 5 bits of blue) of video data correspond to 1 pixel. but, stn controller will use only 12 bit color data. it means that only upper 4bit each color data will be used as pixel data (r[15:12], g[10:7], b[4:1]). the following table shows color data format in words: rgb order data [31:28] [27:21] [20:16] [15:11] [10:5] [4:0] word #1 red( 1) green(1) blue( 1) red( 2) green( 2) blue( 2) word #2 red( 3) green(3) blue( 3) red( 4) green( 4) blue( 4) word #3 red( 5) green(5) blue( 5) red( 6) green( 6) blue( 6)
lcd controller s3 c2440a risc microprocessor 15- 12 4-bit dual scan display 4-bit single scan display 8-bit single scan display . . . . . . . . . . . . vd3 vd2 vd1 vd0 vd3 vd2 vd1 vd0 vd3 vd2 vd1 vd0 vd3 vd2 vd1 vd0 vd3 vd2 vd1 vd0 vd3 vd2 vd1 vd0 . . . . . . vd7 vd6 vd5 vd4 vd3 vd2 vd1 vd0 . . . . . . figure 15-2. monochrome display types (stn)
S3C2440a risc microprocessor lcd controller 15- 13 vd3 r1 vd2 g1 vd1 b1 vd0 r2 vd3 g2 vd2 b2 vd1 r3 vd0 g3 . . . . . . 1 pixel . . . . . . 4-bit dual scan display vd3 r1 vd2 g1 vd1 b1 vd0 r2 vd3 g2 vd2 b2 vd1 r3 vd0 g3 . . . . . . 1 pixel 4-bit single scan display vd7 r1 vd6 g1 vd5 b1 vd4 r2 vd7 g2 vd6 b2 vd5 r3 vd4 g3 . . . . . . 1 pixel 8-bit single scan display vd7 r1 vd6 g1 vd5 b1 vd4 r2 vd3 g2 vd2 b2 vd1 r3 vd0 g3 figure 15-3. color display types (stn)
lcd controller s3 c2440a risc microprocessor 15- 14 timing requirements image data should be transferred from the memory to the lcd driver using the vd[7:0] signal. vclk signal is used to clock the data into the lcd driver's shift register. after each horizontal line of data has been shifted into the lcd driver's shift register, the vline signal is asserted to display the line on the panel. the vm signal provides an ac signal for the display. the lcd uses the signal to alternate the polarity of the row and column voltages, which are used to turn the pixels on and off, because the lcd plasma tends to deteriorate whenever subjected to a dc voltage. it can be configured to toggle on every frame or to toggle every programmable number of vline signals. figure 15-4 shows the timing requirements for the lcd driver interface.
S3C2440a risc microprocessor lcd controller 15- 15 wdly wlh line1 line2 line3 line4 line5 line6 line1 linen first line timing linecnt decreases & display the 1st line lineblank first line check & data timing vframe vm vline vframe vm vline linecnt vclk vframe vm vline vclk vd[7:0] wdly wdly display the last line of the previous frame full frame timing(mmode = 1, mval=0x2) int_frsyn int_frsyn vframe vm vline full frame timing(mmode = 0) line1 line2 line3 line4 line5 line6 line1 linen int_frsyn figure 15-4. 8-bit single scan display type stn lcd timing
lcd controller s3 c2440a risc microprocessor 15- 16 tft lcd controller operation the timegen generates the control signals for lcd driver, such as vsync, hsync, vclk, vden, and lend signal. these control signals are highly related with the configurations on the lcdcon1/2/3/4/5 registers in the regbank. base on these programmable configurations on the lcd control registers in the regbank, the timegen can generate the programmable control signals suitable for the support of many different types of lcd drivers. the vsync signal is asserted to cause the lcd's line pointer to start over at the top of the display. the vsync and hsync pulse generation depends on the configurations of both the hozval field and the lineval field in the lcdcon2/3 registers. the hozval and lineval can be determined by the size of the lcd panel according to the following equations: ? hozval = (horizontal display size) -1 ? lineval = (vertical display size) -1 the rate of vclk signal depends on the clkval field in the lcdcon1 register. table 15-3 defines the relationship of vclk and clkval. the minimum value of clkval is 0. vclk(hz) = hclk/[(clkval+1)x2] the frame rate is vsync signal frequency. the frame rate is related with the field of vsync, vbpd, vfpd, lineval, hsync, hbpd, hfpd, hozval, and clkval in lcdcon1 and lcdcon2/3/4 registers. most lcd drivers need their own adequate frame rate. the frame rate is calculated as follows: frame rate = 1/ [ { (vspw+1) + (vb pd+1) + (liineval + 1) + (vfpd+1) } x {(hspw+1) + (hbpd +1) + (hfpd+1) + (hozval + 1) } x { 2 x ( clkval+1 ) / ( hclk ) } ] table 15-3. relation between vclk and clkval (tft, hclk = 60mhz) clkval 60mhz/x vclk 1 60 mhz/4 15.0 mhz 2 60 mhz/6 10.0 mhz : : : 1023 60 mhz/2048 30.0 khz video operation the tft lcd controller within the S3C2440a supports 1, 2, 4 or 8 bpp (bit per pixel) palettized color displays and 16 or 24 bpp non-palettized true-color displays. 256 color palette the S3C2440a can support the 256 color palette for various selection of color mapping, providing flexible operation for users.
S3C2440a risc microprocessor lcd controller 15- 17 memory data format (tft) this section includes some examples of each display mode. 24bpp display (bswp = 0, hwswp = 0, bpp24bl = 0) d[31:24] d[23:0] 000h dummy bit p1 004h dummy bit p2 008h dummy bit p3 ... (bswp = 0, hwswp = 0, bpp24bl = 1) d[31:8] d[7:0] 000h p1 dummy bit 004h p2 dummy bit 008h p3 dummy bit ... p1 p2 p3 p4 p5 ...... lcd panel vd pin descriptions at 24bpp vd 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 red 7 6 5 4 3 2 1 0 green 7 6 5 4 3 2 1 0 blue 7 6 5 4 3 2 1 0
lcd controller s3 c2440a risc microprocessor 15- 18 16bpp display (bswp = 0, hwswp = 0) d[31:16] d[15:0] 000h p1 p2 004h p3 p4 008h p5 p6 ... (bswp = 0, hwswp = 1) d[31:16] d[15:0] 000h p2 p1 004h p4 p3 008h p6 p5 ... p1 p2 p3 p4 p5 ...... lcd panel vd pin descriptions at 16bpp (5:6:5) vd 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 red 4 3 2 1 0 nc nc nc green 5 4 3 2 1 0 blue 4 3 2 1 0 (5:5:5:i) vd 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 red 4 3 2 1 0 i nc nc nc green 4 3 2 1 0 i blue 4 3 2 1 0 i note: the unused vd pins can be used as gpio
S3C2440a risc microprocessor lcd controller 15- 19 8bpp display (bswp = 0, hwswp = 0) d[31:24] d[23:16] d[15:8] d[7:0] 000h p1 p2 p3 p4 004h p5 p6 p7 p8 008h p9 p10 p11 p12 ... (bswp = 1, hwswp = 0) d[31:24] d[23:16] d[15:8] d[7:0] 000h p4 p3 p2 p1 004h p8 p7 p6 p5 008h p12 p11 p10 p9 ... p1 p2 p3 p4 p5 ...... lcd panel p6 p7 p8 p10 p11 p12 p9
lcd controller s3 c2440a risc microprocessor 15- 20 4bpp display (bswp = 0, hwswp = 0) d[31:28] d[27:24] d[23:20] d[19:16] d[15:12] d[11:8] d[7:4] d[3:0] 000h p1 p2 p3 p4 p5 p6 p7 p8 004h p9 p10 p11 p12 p13 p14 p15 p16 008h p17 p18 p19 p20 p21 p22 p23 p24 ... (bswp = 1, hwswp = 0) d[31:28] d[27:24] d[23:20] d[19:16] d[15:12] d[11:8] d[7:4] d[3:0] 000h p7 p8 p5 p6 p3 p4 p1 p2 004h p15 p16 p13 p14 p11 p12 p9 p10 008h p23 p24 p21 p22 p19 p20 p17 p18 ... 2bpp display (bswp = 0, hwswp = 0) d [31:30] [29:28] [27:26] [25:24] [23:22] [21:20] [19:18] [17:16] 000h p1 p2 p3 p4 p5 p6 p7 p8 004h p17 p18 p19 p20 p21 p22 p23 p24 008h p33 p34 p35 p36 p37 p38 p39 p40 ... d [15:14] [13:12] [11:10] [9:8] [7:6] [5:4] [3:2] [1:0] 000h p9 p10 p11 p12 p13 p14 p15 p16 004h p25 p26 p27 p28 p29 p30 p31 p32 008h p41 p42 p43 p44 p45 p46 p47 p48 ...
S3C2440a risc microprocessor lcd controller 15- 21 256 palette usage (tft) palette configuration and format control the S3C2440a provides 256 color palette for tft lcd control. the user can select 256 colors from the 64k colors in these two formats. the 256 color palette consists of the 256 (depth) x 16-bit spsram. the palette supports 5:6:5 (r:g:b) format and 5:5:5:1(r:g:b:i) format. when the user uses 5:5:5:1 format, the intensity data(i) is used as a common lsb bit of each rgb data. so, 5:5:5:1 format is the same as r(5+i):g(5+i):b(5+i) format. in 5:5:5:1 format, for example, the user can write the palette as in table 15-5 and then connect vd pin to tft lcd panel(r(5+i)=vd[23:19]+vd[18], vd[10] or vd[2], g(5+i)=vd[15:11]+ vd[18], vd[10] or vd[2] , b(5+i)=vd[7:3]+ vd[18], vd[10] or vd[2] .), and set frm565 of lcdcon5 register to 0. table 15-4. 5:6:5 format index\bit pos. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 address 00h r4 r3 r2 r1 r0 g5 g4 g3 g2 g1 g0 b4 b3 b2 b1 b0 1) 0x4d000400 01h r4 r3 r2 r1 r0 g5 g4 g3 g2 g1 g0 b4 b3 b2 b1 b0 0x4d000404 ....... ....... ffh r4 r3 r2 r1 r0 g5 g4 g3 g2 g1 g0 b4 b3 b2 b1 b0 0x4d0007fc number of vd 23 22 21 20 19 15 14 13 12 11 10 7 6 5 4 3 table 15-5. 5:5:5:1 format index\bit pos. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 address 00h r4 r3 r2 r1 r0 g4 g3 g2 g1 g0 b4 b3 b2 b1 b0 i 0x4d000400 01h r4 r3 r2 r1 r0 g4 g3 g2 g1 g0 b4 b3 b2 b1 b0 i 0x4d000404 ....... ....... ffh r4 r3 r2 r1 r0 g4 g3 g2 g1 g0 b4 b3 b2 b1 b0 i 0x4d0007fc number of vd 23 22 21 20 19 15 14 13 12 11 7 6 5 4 3 2) notes: 1. 0x4d000400 is palette start address. 2. vd18, vd10 and vd2 have the sam e output value, i. 3. data[31:16] is invalid. palette read/write when the user performs read/write operation on the palette, hstatus and vstatus of lcdcon5 register must be checked, for read/write operation is prohibited during the active status of hstatus and vstatus. temp orary palette configuration the S3C2440a allows the user to fill a frame with one color without complex modification to fill the one color to the frame buffer or palette. the one colored frame can be displayed by the writing a value of the color which is displayed on lcd panel to tpalval of tpal register and enable tpalen.
lcd controller s3 c2440a risc microprocessor 15- 22 1 2 3 4 5 lcd panel 16bpp 5:5:5+1 format(non-palette) a[31] a[30] a[29] a[28] a[27] a[26]a[25] a[24] a[23] a[22] a[21] a[20] a[19]a[18] a[17] a[16] r4 r3 r2 r1 r0 g4 g3 g2 g1 g0 r4 b3 b2 b1 b0 i a[15] a[14] a[13] a[12] a[11] a[10] a[9] a[8] a[7] a[6] a[5] a[4] a[3] a[2] a[1] a[0] r4 r3 r2 r1 r0 g4 g3 g2 g1 g0 r4 b3 b2 b1 b0 i 1 2 3 4 5 lcd panel 16bpp 5:6:5 format(non-palette) a[31] a[30] a[29] a[28] a[27] a[26]a[25] a[24] a[23] a[22] a[21] a[20] a[19]a[18] a[17] a[16] a[15] a[14] a[13] a[12]a[11] a[10] a[9] a[8] a[7] a[6] a[5] a[4] a[3] a[2] a[1] a[0] r4 r3 r2 r1 r0 g5 g4 g3 g2 g1 g0 b4 b3 b2 b1 b0 r4 r3 r2 r1 r0 g5 g4 g3 g2 g1 g0 b4 b3 b2 b1 b0 figure 15-5. 16bpp display types (tft)
S3C2440a risc microprocessor lcd controller 15- 23 int_frsyn vsync hsync vden hsync vclk vd lend vbpd+1 vspw+1 vfpd+1 hbpd+1 hfpd+1 hspw+1 vden 1 frame 1 line lineval +1 hozval+1 figure 15-6. tft lcd timing example
lcd controller s3 c2440a risc microprocessor 15- 24 samsung tft lcd panel (3.5? portrait / 256k color / reflective a-si/transflective a-si tft lcd) the S3C2440a supports following sec tft lcd panels. 1. samsung 3.5? portrait / 256k color /reflective a-si tft lcd. lts350q1-pd1: tft lcd panel with touch panel and front light unit lts350q1-pd2: tft lcd panel only 2. samsung 3.5? portrait / 256k color /transflective a-si tft lcd. lts350q1-pe1: tft lcd panel with touch panel and front light unit lts350q1-pe2: tft lcd panel only the S3C2440a provides timing signals as follows to use lts 350q1-pd1 / pd2 and lts350q1-pe1 / pe2 lts 350q1-pd1 / pd2 lts350q1-pe1 / pe2 sth: horizontal start pulse tp: source driver data load pulse inv: digital data inversion lcd_hclk: horizontal sampling clock cpv: vertical shift clock stv: vertical start pulse oe: gate on enable rev: inversion signal revb: inversion signal sth: horizontal start pulse tp: source driver data load pulse inv: digital data inversion lcd_hclk: horizontal sampling clock cpv: vertical shift clock stv: vertical start pulse lccinv: source drive ic sampling inversion signal rev: vcom modulation signal revb: inversion signal so, lts 350q1-pd1/2 and pe1/2 can be connected with the S3C2440a without using the additional timing control logic. but the user should additionally apply vcom generator circuit, various voltages, inv signal and gray scale voltage generator circuit, which is recommended by product information (spec) of lts 350q1-pd1/2 and pe1/2. detailed timing diagram is also described in product information (spec) of lts 350q1-pd1/2 and pe1/2. refer to the documentation (product information of lts 350q1-pd1/2 and pe1/2), which is prepared by amlcd technical customer center of samsung electronics co., ltd. caution: ? the S3C2440a has hclk, working as the clock of ahb bus. ? sec tft lcd panel (lts350q1-pd1/2 and pe1/2) has horizontal sampling clock (hclk). ? these two hclks may cause a confusion. so, note that hclk of the S3C2440a is hclk and other hclk of the lts350 is lcd_hclk. check that the hclk of sec tft lcd panel (lts350q1-pd1/2 and pe1/2) is changed to lcd_hclk.
S3C2440a risc microprocessor lcd controller 15- 25 virtual display (tft/stn) the S3C2440a supports hardware horizontal or vertical scrolling. if the screen is scrolled, the fields of lcdbaseu and lcdbasel in lcdsaddr1/2 registers need to be changed (see figure 15-8), except the values of pagewidth and offsize. the video buffer in which the image is stored should be larger than the lcd panel screen in size. this is the data of line 1 of virtual screen. this is the data of line 1 of virtual screen. this is the data of line 2 of virtual screen. this is the data of line 2 of virtual screen. this is the data of line 3 of virtual screen. this is the data of line 3 of virtual screen. this is the data of line 4 of virtual screen. this is the data of line 4 of virtual screen. this is the data of line 5 of virtual screen. this is the data of line 5 of virtual screen. this is the data of line 6 of virtual screen. this is the data of line 6 of virtual screen. this is the data of line 7 of virtual screen. this is the data of line 7 of virtual screen. this is the data of line 8 of virtual screen. this is the data of line 8 of virtual screen. this is the data of line 9 of virtual screen. this is the data of line 9 of virtual screen. this is the data of line 10 of virtual screen. this is the data of line 10 of virtual screen. this is the data of line 11 of virtual screen. this is the data of line 11 of virtual screen. . . . before scrolling view port (the same size of lcd panel.) lineval + 1 offsize pagewidth this is the data of line 1 of virtual screen. this is the data of line 1 of virtual screen. this is the data of line 2 of virtual screen. this is the data of line 2 of virtual screen. this is the data of line 3 of virtual screen. this is the data of line 3 of virtual screen. this is the data of line 4 of virtual screen. this is the data of line 4 of virtual screen. this is the data of line 5 of virtual screen. this is the data of line 5 of virtual screen. this is the data of line 6 of virtual screen. this is the data of line 6 of virtual screen. this is the data of line 7 of virtual screen. this is the data of line 7 of virtual screen. this is the data of line 8 of virtual screen. this is the data of line 8 of virtual screen. this is the data of line 9 of virtual screen. this is the data of line 9 of virtual screen. this is the data of line 10 of virtual screen. this is the data of line 10 of virtual screen. this is the data of line 11 of virtual screen. this is the data of line 11 of virtual screen. . . . after scrolling lcdbaseu lcdbasel offsize figure 15-7. example of scrolling in virtual display (single scan)
lcd controller s3 c2440a risc microprocessor 15- 26 lcd power enable (stn/tft) the S3C2440a provides power enable (pwren) function. when pwren is set to make pwren signal enabled, the output value of lcd_pwren pin is controlled by envid. in other words, if lcd_pwren pin is connected to the power on/off control pin of the lcd panel, the power of lcd panel is controlled by the setting of envid automatically. the S3C2440a also supports invpwren bit to invert polarity of the pwren signal. this function is available only when lcd panel has its own power on/off control port and when port is connected to lcd_pwren pin. vsync hsync vden lcd_pwren 1 frame envid lcd panel on tft lcd vline vframe stn lcd lcd_pwren lcd panel on envid figure 15-8. example of pwren function (pwren=1, invpwren=0)
S3C2440a risc microprocessor lcd controller 15- 27 lcd controller special registers lcd control 1 register register address r/w description reset value lcdcon1 0x4d000000 r/w lcd control 1 register 0x00000000 lcdcon1 bit description initial state linecnt (read only) [27:18] provide the status of the line counter. down count from lineval to 0 0000000000 clkval [17:8] determine the rates of vclk and clkval[9:0]. stn : vclk = hclk / (clkval x 2) ( clkval 3 2 ) tft : vclk = hclk / [(clkval+1) x 2] ( clkval 3 0 ) 0000000000 mmode [7] determine the toggle rate of the vm. 0 = each frame 1 = the rate defined by the mval 0 pnrmode [6:5] select the display mode. 00 = 4-bit dual scan display mode (stn) 01 = 4-bit single scan display mode (stn) 10 = 8-bit single scan display mode (stn) 11 = tft lcd panel 00 bppmode [4:1] select the bpp (bits per pixel) mode. 0000 = 1 bpp for stn, monochrome mode 0001 = 2 bpp for stn, 4-level gray mode 0010 = 4 bpp for stn, 16-level gray mode 0011 = 8 bpp for stn, color mode (256 color) 0100 = packed 12 bpp for stn, color mode (4096 color) 0101 = unpacked 12 bpp for stn, color mode (4096 color) 0110 = 16 bpp for stn, color mode (4096 color) 1000 = 1 bpp for tft 1001 = 2 bpp for tft 1010 = 4 bpp for tft 1011 = 8 bpp for tft 1100 = 16 bpp for tft 1101 = 24 bpp for tft 0000 envid [0] lcd video output and the logic enable/disable. 0 = disable the video output and the lcd control signal. 1 = enable the video output and the lcd control signal. 0
lcd controller s3 c2440a risc microprocessor 15- 28 lcd control 2 register register address r/w description reset value lcdcon2 0x4d000004 r/w lcd control 2 register 0x00000000 lcdcon2 bit description initial state vbpd [31:24] tft : vertical back porch is the number of inactive lines at the start of a frame, after vertical synchronization period. stn : these bits should be set to zero on stn lcd. 0x00 lineval [23:14] tft/stn : these bits determine the vertical size of lcd panel. 0000000000 vfpd [13:6] tft : vertical front porch is the number of inactive lines at the end of a frame, before vertical synchronization period. stn : these bits should be set to zero on stn lcd. 00000000 vspw [5:0] tft : vertical sync pulse width determines the vsync pulse's high level width by counting the number of inactive lines. stn : these bits should be set to zero on stn lcd. 000000
S3C2440a risc microprocessor lcd controller 15- 29 lcd control 3 register register address r/w description reset value lcdcon3 0x4d000008 r/w lcd control 3 register 0x00000000 lcdcon3 bit description initial state hbpd (tft) [25:19] tft : horizontal back porch is the number of vclk periods between the falling edge of hsync and the start of active data. 0000000 wdly (stn) stn : wdly[1:0] bits determine the delay between vline and vclk by counting the number of the hclk. wdly[7:2] are reserved. 00 = 16 hclk, 01 = 32 hclk, 10 = 48 hclk, 11 = 64 hclk hozval [18:8] tft/stn : these bits determine the horizontal size of lcd panel. hozval has to be determined to meet the condition that total bytes of 1 line are 4n bytes. if the x size of lcd is 120 dot in mono mode, x=120 cannot be supported because 1 line consists of 15 bytes. instead, x=128 in mono mode can be supported because 1 line is composed of 16 bytes (2n). lcd panel driver will discard the additional 8 dot. 00000000000 hfpd (tft) [7:0] tft : horizontal front porch is the number of vclk periods between the end of active data and the rising edge of hsync. 0x00 lineblank (stn) stn : these bits indicate the blank time in one horizontal line duration time. these bits adjust the rate of the vline finely. the unit of lineblank is hclk x 8. ex) if the value of lineblank is 10, the blank time is inserted to vclk during 80 hclk. programming note : in case of stn lcd, (lineblank + wlh + wdly) value should be bigger than (14+12tmax). (lineblank + wlh + wdly) ? (14 + 8xt max1 + 4xt max2 = 14 + 12t max ) legend : (1) 14: sdram auto refresh bus acquisition cycles (2) 8x tmax1 : cache fill cycle x the slowest memory access time(ex, rom) (3) 4x tmax2 : 0xc~0xe address frame memory access time
lcd controller s3 c2440a risc microprocessor 15- 30 lcd control 4 register register address r/w description reset value lcdcon4 0x4d00000c r/w lcd control 4 register 0x00000000 lcdcon4 bit description initial state mval [15:8] stn : these bit define the rate at which the vm signal will toggle if the mmode bit is set to logic '1'. 0x00 hspw(tft) [7:0] tft : horizontal sync pulse width determines the hsync pulse's high level width by counting the number of the vclk. 0x00 wlh(stn) stn : wlh[1:0] bits determine the vline pulse's high level width by counting the number of the hclk. wlh[7:2] are reserved. 00 = 16 hclk, 01 = 32 hclk, 10 = 48 hclk, 11 = 64 hclk
S3C2440a risc microprocessor lcd controller 15- 31 lcd control 5 register register address r/w description reset value lcdcon5 0x4d000010 r/w lcd control 5 register 0x00000000 lcdcon5 bit description initial state reserved [31:17] this bit is reserved and the value should be ?0?. 0 vstatus [16:15] tft : vertical status (read only). 00 = vsync 01 = back porch 10 = active 11 = front porch 00 hstatus [14:13] tft : horizontal status (read only). 00 = hsync 01 = back porch 10 = active 11 = front porch 00 bpp24bl [12] tft : this bit determines the order of 24 bpp video memory. 0 = lsb valid 1 = msb valid 0 frm565 [11] tft : this bit selects the format of 16 bpp output video data. 0 = 5:5:5:1 format 1 = 5:6:5 format 0 invvclk [10] stn/tft : this bit controls the polarity of the vclk active edge. 0 = the video data is fetched at vclk falling edge 1 = the video data is fetched at vclk rising edge 0 invvline [9] stn/tft : this bit indicates the vline/hsync pulse polarity. 0 = normal 1 = inverted 0 invvframe [8] stn/tft : this bit indicates the vframe/vsync pulse polarity. 0 = normal 1 = inverted 0 invvd [7] stn/tft : this bit indicates the vd (video data) pulse polarity. 0 = normal 1 = vd is inverted. 0
lcd controller s3 c2440a risc microprocessor 15- 32 lcd control 5 register (continued) lcdcon5 bit description initial state invvden [6] tft : this bit indicates the vden signal polarity. 0 = normal 1 = inverted 0 invpwren [5] stn/tft : this bit indicates the pwren signal polarity. 0 = normal 1 = inverted 0 invlend [4] tft : this bit indicates the lend signal polarity. 0 = normal 1 = inverted 0 pwren [3] stn/tft : lcd_pwren output signal enable/disable. 0 = disable pwren signal 1 = enable pwren signal 0 enlend [2] tft : lend output signal enable/disable. 0 = disable lend signal 1 = enable lend signal 0 bswp [1] stn/tft : byte swap control bit. 0 = swap disable 1 = swap enable 0 hwswp [0] stn/tft : half-word swap control bit. 0 = swap disable 1 = swap enable 0
S3C2440a risc microprocessor lcd controller 15- 33 frame buffer start address 1 register register address r/w description reset value lcdsaddr1 0x4d000014 r/w stn/tft : frame buffer start address 1 register 0x00000000 lcdsaddr1 bit description initial state lcdbank [29:21] these bits indicate a[30:22] of the bank location for the video buffer in the system memory. lcdbank value cannot be changed even when moving the view port. lcd frame buffer should be within aligned 4mb region, which ensures that lcdbank value will not be changed when moving the view port. so, care should be taken to use the malloc() function. 0x00 lcdbaseu [20:0] for dual-scan lcd : these bits indicate a[21:1] of the start address of the upper address counter, which is for the upper frame memory of dual scan lcd or the frame memory of single scan lcd. for single-scan lcd : these bits indicate a[21:1] of the start address of the lcd frame buffer. 0x000000 frame buffer start address 2 register register address r/w description reset value lcdsaddr2 0x4d000018 r/w stn/tft : frame buffer start address 2 register 0x00000000 lcdsaddr2 bit description initial state lcdbasel [20:0] for dual-scan lcd: these bits indicate a[21:1] of the start address of the lower address counter, which is used for the lower frame memory of dual scan lcd. for single scan lcd: these bits indicate a[21:1] of the end address of the lcd frame buffer. lcdbasel = ((the frame end address) >>1) + 1 = lcdbaseu + (pagewidth+offsize) x (lineval+1) 0x0000 note: users can change the lcdbaseu and lcdbasel values for scrolling while the lcd controller is turned on. but, users must not change the value of the lcdbaseu and lcdbasel registers at the end of frame by referring to the linecnt field in lcdcon1 register, for the lcd fifo fetches the next frame data prior to the change in the frame. so, if you change the frame, the pre-fetched fifo data will be obsolete and lcd controller will disp lay an incorrect screen. to check the linecnt, interrupts should be masked. if any interrupt is executed just after reading linecnt, the read linecnt value may be obsolete because of the execution time of interrupt service routine (isr).
lcd controller s3 c2440a risc microprocessor 15- 34 frame buffer start address 3 register register address r/w description reset value lcdsaddr3 0x4d00001c r/w stn/tft : virtual screen address set 0x00000000 lcdsaddr3 bit description initial state offsize [21:11] virtual screen offset size (the number of half words). this value defines the difference between the address of the last half word displayed on the previous lcd line and the address of the first half word to be displayed in the new lcd line. 00000000000 pagewidth [10:0] virtual screen page width (the number of half words). this value defines the width of the view port in the frame. 000000000 note: the values of pagewidth and offsize must be changed when envid bit is 0. example 1. lcd panel = 320 x 240, 16gray, single scan frame start address = 0x0c500000 offset dot number = 2048 dots ( 512 half words ) lineval = 240-1 = 0xef pagewidth = 320 x 4 / 16 = 0x50 offsize = 512 = 0x200 lcdbank = 0x0c500000 >> 22 = 0x31 lcdbaseu = 0x100000 >> 1 = 0x80000 lcdbasel = 0x80000 + ( 0x50 + 0x200 ) x ( 0xef + 1 ) = 0xa2b00 example 2. lcd panel = 320 x 240, 16gray, dual scan frame start address = 0x0c500000 offset dot number = 2048 dots ( 512 half words ) lineval = 120-1 = 0x77 pagewidth = 320 x 4 / 16 = 0x50 offsize = 512 = 0x200 lcdbank = 0x0c500000 >> 22 = 0x31 lcdbaseu = 0x100000 >> 1 = 0x80000 lcdbasel = 0x80000 + ( 0x50 + 0x200 ) x ( 0x77 + 1 ) = 0x91580 example 3. lcd panel = 320*240, color, single scan frame start address = 0x0c500000 offset dot number = 1024 dots ( 512 half words ) lineval = 240-1 = 0xef pagewidth = 320 x 8 / 16 = 0xa0 offsize = 512 = 0x200 lcdbank = 0x0c500000 >> 22 = 0x31 lcdbaseu = 0x100000 >> 1 = 0x80000 lcdbasel = 0x80000 + ( 0xa0 + 0x200 ) x ( 0xef + 1 ) = 0xa7600
S3C2440a risc microprocessor lcd controller 15- 35 red lookup table register register address r/w description reset value redlut 0x4d000020 r/w stn : red lookup table register 0x00000000 redlut bit description initial state redval [31:0] these bits define which of the 16 shades will be chosen by each of the 8 possible red combinations. 000 = redval[3:0], 001 = redval[7:4] 010 = redval[11:8], 011 = redval[15:12] 100 = redval[19:16], 101 = redval[23:20] 110 = redval[27:24], 111 = redval[31:28] 0x00000000 green lookup table register register address r/w description reset value greenlut 0x4d000024 r/w stn : green lookup table register 0x00000000 greenlut bit description initial state greenval [31:0] these bits define which of the 16 shades will be chosen by each of the 8 possible green combinations. 000 = greenval[3:0], 001 = greenval[7:4] 010 = greenval[11:8], 011 = greenval[15:12] 100 = greenval[19:16], 101 = greenval[23:20] 110 = greenval[27:24], 111 = greenval[31:28] 0x00000000 blue lookup table register register address r/w description reset value bluelut 0x4d000028 r/w stn : blue lookup table register 0x0000 bulelut bit description initial state blueval [15:0] these bits define which of the 16 shades will be chosen by each of the 4 possible blue combinations. 00 = blueval[3:0], 01 = blueval[7:4] 10 = blueval[11:8], 11 = blueval[15:12] 0x0000 note: address from 0x14a0002c to 0x14a00048 should not be used. this area is reserved for test mode.
lcd controller s3 c2440a risc microprocessor 15- 36 dithering mode register register address r/w description reset value dithmode 0x4d00004c r/w stn : dithering mode register. this register reset value is 0x00000 but, user can change this value to 0x12210. (refer to a sample program source for the latest value of this register.) 0x00000 dithmode bit description initial state dithmode [18:0] use one of following value for your lcd: 0x00000 or 0x12210 0x00000
S3C2440a risc microprocessor lcd controller 15- 37 temp palette register register address r/w description reset value tpal 0x4d000050 r/w tft : temporary palette register. this register value will be video data at next frame. 0x00000000 tpal bit description initial state tpalen [24] temporary palette register enable bit. 0 = disable 1 = enable 0 tpalval [23:0] temporary palette value register. tpalval[23:16] : red tpalval[15:8] : green tpalval[7:0] : blue 0x000000
lcd controller s3 c2440a risc microprocessor 15- 38 lcd i nterrupt pending register register address r/w description reset value lcdintpnd 0x4d000054 r/w indicate the lcd interrupt pending register 0x0 lcdintpnd bit description initial state int_frsyn [1] lcd frame synchronized interrupt pending bit. 0 = the interrupt has not been requested. 1 = the frame has asserted the interrupt request. 0 int_ficnt [0] lcd fifo interrupt pending bit. 0 = the interrupt has not been requested. 1 = lcd fifo interrupt is requested when lcd fifo reaches trigger level. 0 lcd s ource pending register register address r/w description reset value lcdsrcpnd 0x4d000058 r/w indicate the lcd interrupt source pending register 0x0 lcdsrcpnd bit description initial state int_frsyn [1] lcd frame synchronized interrupt source pending bit. 0 = the interrupt has not been requested. 1 = the frame has asserted the interrupt request. 0 int_ficnt [0] lcd fifo interrupt source pending bit. 0 = the interrupt has not been requested. 1 = lcd fifo interrupt is requested when lcd fifo reaches trigger level. 0
S3C2440a risc microprocessor lcd controller 15- 39 lcd i nterrupt mask register register address r/w description reset value lcdintmsk 0x4d00005c r/w determine which interrupt source is masked. the masked interrupt source will not be serviced. 0x3 lcdintmsk bit description initial state fiwsel [2] determine the trigger level of lcd fifo. 0 = 4 words 1 = 8 words int_frsyn [1] mask lcd frame synchronized interrupt. 0 = the interrupt service is available. 1 = the interrupt service is masked. 1 int_ficnt [0] mask lcd fifo interrupt. 0 = the interrupt service is available. 1 = the interrupt service is masked. 1
lcd controller s3 c2440a risc microprocessor 15- 40 tcon c ontrol register register address r/w description reset value tconsel 0x4d000060 r/w this register controls the lpc3600/lcc3600 modes. 0xf84 tconsel bit description initial state lcc_test2 [11] lcc3600 test mode 2 ( read only ) 1 lcc_test1 [10] lcc3600 test mode 1 ( read only ) 1 lcc_sel5 [9] select stv polarity 1 lcc_sel4 [8] select cpv signal pin 0 1 lcc_sel3 [7] select cpv signal pin 1 1 lcc_sel2 [6] select line/dot inversion 0 lcc_sel1 [5] select dg/normal mode 0 lcc_en [4] determine lcc3600 enable/disable 0 = lcc3600 disable 1 = lcc3600 enable 0 cpv_sel [3] select cpv pulse low width 0 mode_sel [2] select de/sync mode 0 = sync mode 1 = de mode 1 res_sel [1] select output resolution type 0 = 320 x 240 1 = 240 x 320 0 lpc_en [0] determine lpc3600 enable/disable 0 = lpc3600 disable 1 = lpc3600 enable 0 note: both lpc_en and lcc_en enable is not permitted. only one tcon can be enabled at the same time.
S3C2440a risc microprocessor lcd controller 15- 41 register setting guide (stn) the lcd controller supports multiple screen sizes by special register setting. the clkval value determines the frequency of vclk. this value has to be determined such that the vclk value is greater than data transmission rate. the data transmission rate for the vd port of the lcd controller is used to determine the value of clkval register. the data transmission rate is given by the following equation: data transmission rate = hs x vs x fr x mv ? hs: horizontal lcd size ? vs: vertical lcd size ? fr: frame rate ? mv: mode dependent value table 15-6. mv value for each display mode mode mv value mono, 4-bit single scan display 1/4 mono, 8-bit single scan display or 4-bit dual scan display 1/8 4 level gray, 4-bit single scan display 1/4 4 level gray, 8-bit single scan display or 4-bit dual scan display 1/8 16 level gray, 4-bit single scan display 1/4 16 level gray, 8-bit single scan display or 4-bit dual scan display 1/8 color, 4-bit single scan display 3/4 color, 8-bit single scan display or 4-bit dual scan display 3/8 the lcdbaseu register value is the first address value of the frame buffer. the lowest 4 bits must be eliminated for burst 4 word access. the lcdbasel register value depends on lcd size and lcdbaseu. the lcdbasel value is given by the following equation: ? lcdbasel = lcdbaseu + lcdb asel offset
lcd controller s3 c2440a risc microprocessor 15- 42 example 1: 160 x 160, 4-level gray, 80 frame/sec, 4-bit single scan display, hclk frequency is 60 mhz wlh = 1, wdly = 1. data transmission rate = 160 x 160 x 80 x 1/4 = 512 khz clkval = 58, vclk = 517khz hozval = 39, lineval = 159 lineblank =10 lcdbasel = lcdbaseu + 3200 note the higher the system load is, the lower the cpu performance. example 2 (virtual screen register): 4 -level gray, virtual screen size = 1024 x 1024, lcd size = 320 x 240, lcdbaseu = 0x64, 4-bit dual scan. 1 halfword = 8 pixels (4-level gray), virtual screen 1 line = 128 halfword = 1024 pixels, lcd 1 line = 320 pixels = 40 halfword, offsize = 128 - 40 = 88 = 0x58, pagewidth = 40 = 0x28 lcdbasel = lcdbaseu + (pagewidth + offsize) x (lineval +1) = 100 + (40 +88) x 120 = 0x3c64
S3C2440a risc microprocessor lcd controller 15- 43 gray level selection guide the S3C2440a lcd controller can generate 16 gray level using frame rate control (frc). the frc characteristics may cause unexpected patterns in gray level. these unwanted erroneous patterns may be shown in fast response lcd or at lower frame rates. because the quality of lcd gray levels depends on lcd's own characteristics, the user has to select an appropriate gray level after viewing all gray levels on user's own lcd. select the gray level quality through the following procedures: 1. get the latest dithering pattern register value from samsung. 2. display 16 gray bar in lcd. 3. change the frame rate into an optimal value. 4. change the vm alternating period to get the best quality. 5. as viewing 16 gray bars, select a good gray level, which is displayed well on your lcd. 6. use only the good gray levels for quality. lcd refresh bus bandwidth calculation guide the S3C2440a lcd controller can support various lcd display sizes. to select a suitable size (for the flicker free lcd system application), the user have to consider the lcd refresh bus bandwidth determined by the lcd display size, bit per pixel (bpp), frame rate, memory bus width, memory type, and so on. lcd data rate (byte/s) = bpp x (horizontal display size) x (vertical display size) x (frame rate) /8 lcd dma burst count (times/s) = lcd data rate(byte/s) /16(byte) ; lcd dma using 4words(16byte) burst pdma means lcd dma access period. in other words, the value of pdma indicates the period of four-beat burst (4- words burst) for video data fetch. so, pdma depends on memory type and memory setting. eventually, lcd system load is determined by lcd dma burst count and pdma. ? lcd system load = lcd dma burst count x pdma example 3: 640 x 480, 8bpp, 60 frame/sec, 16-bit data bus width, sdram (trp=2hclk / trcd=2hclk / cl=2hclk) and hclk frequency is 60 mhz lcd data rate = 8 x 640 x 480 x 60 / 8 = 18.432mbyte/s lcd dma burst count = 18.432 / 16 = 1.152m/s pdma = (trp+trcd+cl+(2 x 4)+1) x (1/60mhz) = 0.250ms lcd system load = 1.152 x 250 = 0.288 system bus occupation rate = (0.288/1) x 100 = 28.8%
lcd controller s3 c2440a risc microprocessor 15- 44 register setting guide (tft lcd) the clkval register value determines the frequency of vclk and frame rate. frame rate = 1/ [ { (vspw+1) + (vbpd+1) + (liineval + 1) + (vfpd+1) } x {(hspw+1) + (hbpd +1) + (hfpd+1) + (hozval + 1) } x { 2 x ( clkval+1 ) / ( hclk ) } ] for applications, the system timing must be considered to avoid under-run condition of the fifo of the lcd controller caused by memory bandwidth contention. example 4: tft resolution: 240 x 240, vspw =2, vbpd =14, lineval = 239, vfpd =4 hspw =25, hbpd =15, hozval = 239, hfpd =1 clkval = 5 hclk = 60 m (hz) the parameters below must be referenced by lcd size and driver specifications: vspw, vbpd, lineval, vfpd, hspw, hbpd, hozval, and hfpd if target frame rate is 60?70hz, then clkval should be 5. so, frame rate = 67hz
S3C2440a risc microprocessor adc and t ouch screen interface 16- 1 16 adc & touch screen interface overview the 10-bit cmos adc (analog to digital converter) is a recycling type device with 8-channel analog inputs. it converts the analog input signal into 10-bit binary digital codes at a maximum conversion rate of 500ksps with 2.5mhz a/d converter clock. a/d converter operates with on-chip sample-and-hold function and power down mode is supported. touch screen interface can control/select pads (xp, xm, yp, ym) of the touch screen for x, y position conversion. touch screen interface contains touch screen pads control logic and adc interface logic with an interrupt generation logic. features ? resolution: 10-bit ? differential linearity error: 1.0 lsb ? integral linearity error: 2.0 lsb ? maximum conversion rate: 500 ksps ? low power consumption ? power supply voltage: 3.3v ? analog input range: 0 ~ 3.3v ? on-chip sample-and-hold function ? normal conversion mode ? separate x/y position conversion mode ? auto(sequential) x/y position conversion mode ? waiting for interrupt mode
adc and touch screen interface S3C2440 a risc microprocessor 16- 2 adc & touch screen interface operation block diagram figure 16-1 shows the functional block diagram of a/d converter and touch screen interface. note that the a/d converter device is a recycling type. pullup waiting for interrupt mode int_tc int_adc 8:1 mux a/d converter adc input control interrupt generation adc interface &touch screen avdd agnd xp xm yp ym a[3:0] (note) (note) touch screen figure 16-1. adc and touch screen interface functional block diagram note: (symbol) when touch screen device is used; xm or pm is only connected ground for touch screen i/f. when touch screen device is not used, xm or pm is connecting analog input signal for no rmal adc conversion.
S3C2440a risc microprocessor adc and t ouch screen interface 16- 3 function descriptions a/d conversion time when the gclk frequency is 50mhz and the prescaler value is 49, total 10-bit conversion time is as follows. a/d converter freq. = 50mhz/(49+1) = 1mhz conversion time = 1/(1mhz / 5cycles) = 1/200khz = 5 us note this a/d converter was designed to operate at maximum 2.5mhz clock, so the conversion rate can go up to 500 ksps. touch screen interface mode 1. normal conversion mode single conversion mode is the most likely used for general purpos e adc conversion. this mode can be initialized by setting the adccon (adc control register) and completed with a read and a write to the adcdat0 (adc data register 0). 2. separate x/y position conversion mode touch screen controller can be operated by one of two conversion modes. separate x/y position conversion mode is operated as the following way. x-position mode writes x-position conversion data to adcdat0, so touch screen interface generates the interrupt source to interrupt controller. y-position mode writes y-position conversion data to adcdat1, so touch screen interface generates the interrupt source to interrupt controller. 3. auto(sequential) x/y position conversion mode auto (sequential) x/y position conversion mode is operated as the following. touch screen controller sequentially converts x-position and y-position that is touched. after touch controller writes x-measurement data to adcdat0 and writes y-measurement data to adcdat1, touch screen interface is generating interrupt source to interrupt controller in auto position conversion mode. 4. waiting for interrupt mode touch screen controller generates interrupt (int_tc) signal when the stylus is down. waiting for interrupt mode setting value is radctsc=0xd3; // xp_pu, xp_dis, xm_dis, yp_dis, ym_en. after touch screen controller generates interrupt signal (int_tc), waiting for interrupt mode must be cleared. (xy_pst sets to the no operation mode) standby mode standby mode is activated when adccon [2] is set to '1'. in this mode, a/d conversion operation is halted and adcdat0, adcdat1 register contains the previous converted data.
adc and touch screen interface S3C2440 a risc microprocessor 16- 4 programming notes 1. the a/d converted data can be accessed by means of interrupt or polling method. with interrupt method the overall conversion time - from a/d converter start to converted data read - may be delayed because of the return time of interrupt service routine and data access time. with polling method, by checking the adccon[15] - end of conversion flag-bit, the read time from adcdat register can be determined. 2. another way for starting a/d conversion is provided. after adccon[1] - a/d conversion start-by-read mode-is set to 1, a/d conversion starts simultaneously whenever converted data is read. xp x-tal clk is used x-conversion yp gclk is used y-conversion pen touch figure 16-2. adc and touch screen operation signal
S3C2440a risc microprocessor adc and t ouch screen interface 16- 5 adc and touch screen interface special registers adc control register (adccon) register address r/w description reset value adccon 0x5800000 r/w adc control register 0x3fc4 adccon bit description initial state ecflg [15] end of conversion flag(read only) 0 = a/d conversion in process 1 = end of a/d conversion 0 prscen [14] a/d converter prescaler enable 0 = disable 1 = enable 0 prscvl [13:6] a/d converter prescaler value data value: 0 ~ 255 note: adc freqeuncy should be set less than pclk by 5times. (ex. pclk=10mhz, adc freq.< 2mhz) 0xff sel_mux [5:3] analog input channel select 000 = ain 0 001 = ain 1 010 = ain 2 011 = ain 3 100 = ym 101 = yp 110 = xm 111 = xp 0 stdbm [2] standby mode select 0 = normal operation mode 1 = standby mode 1 read_ start [1] a/d conversion start by read 0 = disable start by read operation 1 = enable start by read operation 0 enable_start [0] a/d conversion starts by enable. if read_start is enabled, this value is not valid. 0 = no operation 1 = a/d conversion starts and this bit is cleared after the start- up. 0 note: when touch screen pads(ym, yp, xm, xp) are disabled, these ports can be used as analog input ports(ain4, ain5, ain6, ain7) for adc.
adc and touch screen interface S3C2440 a risc microprocessor 16- 6 adc touch screen control register (adctsc) register address r/w description reset value adctsc 0x5800004 r/w adc touch screen control register 0x58 adctsc bit description initial state ud_sen [8] detect stylus up or down status. 0 = detect stylus down interrupt signal. 1 = detect stylus up interrupt signal. 0 ym_sen [7] ym switch enable 0 = ym output driver disable. 1 = ym output driver enable. 0 yp_sen [6] yp switch enable 0 = yp output driver enable. 1 = yp output driver disable. 1 xm_sen [5] xm switch enable 0 = xm output driver disable. 1 = xm output driver enable. 0 xp_sen [4] xp switch enable 0 = xp output driver enable. 1 = xp output driver disable. 1 pull_up [3] pull-up switch enable 0 = xp pull-up enable. 1 = xp pull-up disable. 1 auto_pst [2] automatically sequencing conversion of x-position and y-position 0 = normal adc conversion. 1 = auto sequential measurement of x-position, y-position. 0 xy_pst [1:0] manually measurement of x-position or y-position. 00 = no operation mode 01 = x-position measurement 10 = y-position measurement 11 = waiting for interrupt mode 0 notes: 1. while waiting for touch screen interrupt, xp_sen bit should be set to ?1?(xp output disable) and pull_up bit should be set to ?0?(xp pull-up enable). 2. auto_pst bit should be set ?1? only in automatic & sequential x/y position conversion. 3. xp, yp should be disconnected with gnd source during sleep mode to avoid leakage current. because xp, yp will be maintained as 'h' states in sleep mode. touch screen pin conditions in x/y position conversion. xp xm yp ym adc ch. select x position vref gnd hi-z hi-z yp y position hi-z hi-z vref gnd xp
S3C2440a risc microprocessor adc and t ouch screen interface 16- 7 adc start delay register (adcdly) register address r/w description reset value adcdly 0x5800008 r/w adc start or interval delay register 0x00ff adcdly bit description initial state delay [15:0] 1) normal conversion mode, xy position mode, auto position mode. ? adc conversion start delay value. 2) waiting for interrupt mode. when stylus down occurs at sleep mode, generates wake-up signal, having interval (several ms), for exiting sleep mode. note: don?t use zero value (0x0000) 00ff note: before adc conversion, touch screen uses x-tal clock (3.68mhz). during adc conversion gclk ( max. 50mhz) is used.
adc and touch screen interface S3C2440 a risc microprocessor 16- 8 adc conversion data register (adcdat0) register address r/w description reset value adcdat0 0x580000c r adc conversion data register ? adcdat0 bit description initial state updown [15] up or down state of stylus at waiting for interrupt mode. 0 = stylus down state. 1 = stylus up state. ? auto_pst [14] automatic sequencing conversion of x-position and y-position 0 = normal adc conversion. 1 = sequencing measurement of x-position, y-position. ? xy_pst [13:12] manually measurement of x-position or y-position. 00 = no operation mode 01 = x-position measurement 10 = y-position measurement 11 = waiting for interrupt mode ? reserved [11:10] reserved ? xpdata (normal adc) [9:0] x-position conversion data value (include normal adc conversion data value) data value: 0 ~ 3ff ?
S3C2440a risc microprocessor adc and t ouch screen interface 16- 9 adc conversion data register (adcdat1) register address r/w description reset value adcdat1 0x5800010 r adc conversion data register ? adcdat1 bit description initial state updown [15] up or down state of stylus at waiting for interrupt mode. 0 = stylus down state. 1 = stylus up state. ? auto_pst [14] automatically sequencing conversion of x-position and y-position 0 = normal adc conversion. 1 = sequencing measurement of x-position, y-position. ? xy_pst [13:12] manually measurement of x-position or y-position. 00 = no operation mode 01 = x-position measurement 10 = y-position measurement 11 = waiting for interrupt mode ? reserved [11:10] reserved ? ypdata [9:0] y-position conversion data value data value: 0 ~ 3ff ? adc touch screen up-down int check register (adcupdn) register address r/w description reset value adcupdn 0x5800014 r/w stylus up or down interrupt status register 0x0 adcupdn bit description initial state tsc_up [1] stylus up interrupt. 0 = no stylus up status. 1 = stylus up interrupt occurred. 0 tsc_dn [0] stylus down interrupt. 0 = no stylus down status. 1 = stylus down interrupt occurred. 0
adc and touch screen interface S3C2440 a risc microprocessor 16- 10 notes
S3C2440a risc microprocessor real time clock 17- 1 17 real time clock overview the real time clock (rtc) unit can be operated by the backup battery while the system power is off. the rtc can transmit 8-bit data to cpu as binary coded decimal (bcd) values using the strb/ldrb arm operation. the data include the time by second, minute, hour, date, day, month, and year. the rtc unit works with an external 32.768khz crystal and also can perform the alarm function. features ? bcd number: second, minute, hour, date, day, month, and year ? leap year generator ? alarm function: alarm interrupt or wake-up from power-off mode ? year 2000 problem is removed. ? independent power pin (rtcvdd) ? supports millisecond tick time interrupt for rtos kernel time tick.
real time clock s3 c2440a risc microprocessor 17- 2 real time clock operation 2 15 clock divider xtortc xtirtc control register sec min hour day date mon year leap year generator alarm generator reset register 1 hz int_rtc rtccon rtcalm rtcrst time tick generator time tick ticnt 128 hz pmwkup figure 17-1. real time clock block diagram leap year generator the leap year generator can determine the last date of each month out of 28, 29, 30, or 31, based on data from bcddate, bcdmon, and bcdyear. this block considers leap year in deciding on the last date. an 8-bit counter can only represent 2 bcd digits, so it cannot decide whether "00" year (the year with its last two digits zeros) is a leap year or not. for example, it cannot discriminate between 1900 and 2000. to solve this problem, the rtc block in S3C2440a has hard-wired logic to support the leap year in 2000. note 1900 is not leap year while 2000 is leap year. therefore, two digits of 00 in S3C2440a denote 2000, not 1900. read/write registers bit 0 of the rtccon register must be set high in order to write the bcd register in rtc block. to display the second, minute, hour, date, month, and year, the cpu should read the data in bcdsec, bcdmin, bcdhour, bcdday, bcddate, bcdmon, and bcdyear registers, respectively, in the rtc block. however, a one second deviation may exist because multiple registers are read. for example, when the user reads the registers from bcdyear to bcdmin, the result is assumed to be 2059 (year), 12 (month), 31 (date), 23 (hour) and 59 (minute). when the user read the bcdsec register and the value ranges from 1 to 59 (second), there is no problem, but, if the value is 0 sec., the year, month, date, hour, and minute may be changed to 2060 (year), 1 (month), 1 (date), 0 (hour) and 0 (minute) because of the one second deviation that was mentioned. in this case, the user should re-read from bcdyear to bcdsec if bcdsec is zero. backup battery operation the rtc logic can be driven by the backup battery, which supplies the power through the rtcvdd pin into the rtc block, even if the system power is off. when the system is off, the interfaces of the cpu and rtc logic should be blocked, and the backup battery only drives the oscillation circuit and the bcd counters to minimize power dissipation .
S3C2440a risc microprocessor real time clock 17- 3 alarm function the rtc generates an alarm signal at a specified time in the power-off mode or normal operation mode. in normal operation mode, the alarm interrupt (int_rtc) is activated. in the power-off mode, the power management wakeup (pmwkup) signal is activated as well as the int_rtc. the rtc alarm register (rtcalm) determines the alarm enable/disable status and the condition of the alarm time setting. tick time interrupt the rtc tick time is used for interrupt request. the ticnt register has an interrupt enable bit and the count value for the interrupt. the count value reaches '0' when the tick time interrupt occurs. then the period of interrupt is as follows: ? period = ( n+1 ) / 128 second ? n: tick time count value (1~127) this rtc time tick may be used for real time operating system (rtos) kernel time tick. if time tick is generated by the rtc time tick, the time related function of rtos will always synchronized in real time. 32.768khz x-tal connection example the figure 17-2 shows a circuit of the rtc unit oscillation at 32.768khz. xtirtc xtortc 32768hz 15~ 22pf figure 17-2. main oscillator circuit example
real time clock s3 c2440a risc microprocessor 17- 4 real time clock special registers real time clock control (rtccon) register the rtccon register consists of 4 bits such as the rtcen, which controls the read/write enable of the bcd registers, clksel, cntsel, and clkrst for testing. rtcen bit can control all interfaces between the cpu and the rtc, so it should be set to 1 in an rtc control routine to enable data read/write after a system reset. also before power off, the rtcen bit should be cleared to 0 to prevent inadvertent writing into rtc registers. register address r/w description reset value rtccon 0x57000040(l) 0x57000043(b) r/w (by byte) rtc control register 0x0 rtccon bit description initial state clkrst [3] rtc clock count reset. 0 = no reset, 1 = reset 0 cntsel [2] bcd count select. 0 = merge bcd counters 1 = reserved (separate bcd counters) 0 clksel [1] bcd clock select. 0 = xtal 1/215 divided clock 1 = reserved (xtal clock only for test) 0 rtcen [0] rtc control enable. 0 = disable 1 = enable note: only bcd time count and read operation can be performed. 0 notes: 1. all rtc registers have to be accessed for each byte unit using strb and ldrb instructions or char type pointer. 2. (l): little endian. (b): big endian. tick time count (ticnt) register register address r/w description reset value ticnt 0x57000044(l) 0x57000047(b) r/w (by byte) tick time count register 0x0 ticnt bit description initial state tick int enable [7] tick time interrupt enable. 0 = disable 1 = enable 0 tick time count [6:0] tick time count value (1~127). this counter value decreases internally, and users cannot read this counter value in working. 000000
S3C2440a risc microprocessor real time clock 17- 5 rtc alarm control (rtcalm) register the rtcalm register determines the alarm enable and the alarm time. please note that the rtcalm register generates the alarm signal through both int_rtc and pmwkup in power down mode, but only through int_rtc in the normal operation mode. register address r/w description reset value rtcalm 0x57000050(l) 0x57000053(b) r/w (by byte) rtc alarm control register 0x0 rtcalm bit description initial state reserved [7] ? 0 almen [6] alarm global enable. 0 = disable, 1 = enable 0 yearen [5] year alarm enable. 0 = disable, 1 = enable 0 monren [4] month alarm enable. 0 = disable, 1 = enable 0 dateen [3] date alarm enable. 0 = disable, 1 = enable 0 houren [2] hour alarm enable. 0 = disable, 1 = enable 0 minen [1] minute alarm enable. 0 = disable, 1 = enable 0 secen [0] second alarm enable. 0 = disable, 1 = enable 0
real time clock s3 c2440a risc microprocessor 17- 6 alarm second data (almsec) register register address r/w description reset value almsec 0x57000054(l) 0x57000057(b) r/w (by byte) alarm second data register 0x0 almsec bit description initial state reserved [7] ? 0 secdata [6:4] bcd value for alarm second. 0 ~ 5 000 [3:0] 0 ~ 9 0000 alarm min data (almmin) register register address r/w description reset value almmin 0x57000058(l) 0x5700005b(b) r/w (by byte) alarm minute data register 0x00 almmin bit description initial state reserved [7] ? 0 mindata [6:4] bcd value for alarm minute. 0 ~ 5 000 [3:0] 0 ~ 9 0000 alarm hour data (almhour) register register address r/w description reset value almhour 0x5700005c(l) 0x5700005f(b) r/w (by byte) alarm hour data register 0x0 almhour bit description initial state reserved [7:6] ? 00 hourdata [5:4] bcd value for alarm hour. 0 ~ 2 00 [3:0] 0 ~ 9 0000
S3C2440a risc microprocessor real time clock 17- 7 alarm date data (almdate) register register address r/w description reset value almdate 0x57000060(l) 0x57000063(b) r/w (by byte) alarm date data register 0x01 almdate bit description initial state reserved [7:6] ? 00 datedata [5:4] bcd value for alarm date, from 0 to 28, 29, 30, 31. 0 ~ 3 00 [3:0] 0 ~ 9 0001 alarm mon data (almmon) register register address r/w description reset value almmon 0x57000064(l) 0x57000067(b) r/w (by byte) alarm month data register 0x01 almmon bit description initial state reserved [7:5] ? 00 mondata [4] bcd value for alarm month. 0 ~ 1 0 [3:0] 0 ~ 9 0001 alarm year data (almyear) register register address r/w description reset value almyear 0x57000068(l) 0x5700006b(b) r/w (by byte) alarm year data register 0x0 almyear bit description initial state yeardata [7:0] bcd value for year. 00 ~ 99 0x0
real time clock s3 c2440a risc microprocessor 17- 8 bcd second (bcdsec) register register address r/w description reset value bcdsec 0x57000070(l) 0x57000073(b) r/w (by byte) bcd second register undefined bcdsec bit description initial state secdata [6:4] bcd value for second. 0 ~ 5 ? [3:0] 0 ~ 9 ? bcd minute (bcdmin) register register address r/w description reset value bcdmin 0x57000074(l) 0x57000077(b) r/w (by byte) bcd minute register undefined bcdmin bit description initial state mindata [6:4] bcd value for minute. 0 ~ 5 ? [3:0] 0 ~ 9 ? bcd hour (bcdhour) register register address r/w description reset value bcdhour 0x57000078(l) 0x5700007b(b) r/w (by byte) bcd hour register undefined bcdhour bit description initial state reserved [7:6] ? ? hourdata [5:4] bcd value for hour. 0 ~ 2 ? [3:0] 0 ~ 9 ?
S3C2440a risc microprocessor real time clock 17- 9 bcd date (bcddate) register register address r/w description reset value bcddate 0x5700007c(l) 0x5700007f(b) r/w (by byte) bcd date register undefined bcddate bit description initial state reserved [7:6] ? ? datedata [5:4] bcd value for date. 0 ~ 3 ? [3:0] 0 ~ 9 ? bcd day (bcdday) register register address r/w description reset value bcdday 0x57000080(l) 0x57000083(b) r/w (by byte) bcd a day of the week register undefined bcdday bit description initial state reserved [7:3] ? ? daydata [2:0] bcd value for a day of the week. 1 ~ 7 ? bcd month (bcdmon) register register address r/w description reset value bcdmon 0x57000084(l) 0x57000087(b) r/w (by byte) bcd month register undefined bcdmon bit description initial state reserved [7:5] ? ? mondata [4] bcd value for month. 0 ~ 1 ? [3:0] 0 ~ 9 ?
real time clock s3 c2440a risc microprocessor 17- 10 bcd year (bcdyear) register register address r/w description reset value bcdyear 0x57000088(l) 0x5700008b(b) r/w (by byte) bcd year register undefined bcdyear bit description initial state yeardata [7:0] bcd value for year. 00 ~ 99 ?
S3C2440a risc microprocessor watchdog timer 18- 1 18 watchdog timer overview the S3C2440a watchdog timer is used to resume the controller operation whenever it is disturbed by malfunctions such as noise and system errors. it can be used as a normal 16-bit interval timer to request interrupt service. the watchdog timer generates the reset signal for 128 pclk cycles. features ? normal interval timer mode with interrupt request ? internal reset signal is activated for 128 pclk cycles when the timer count value reaches 0 (time-out).
watchdog timer s3c 2440a risc microprocessor 18- 2 watchdog timer operation figure 18-1 shows the functional block diagram of the watchdog timer. the watchdog timer uses only pclk as its source clock. the pclk frequency is prescaled to generate the corresponding watchdog timer clock, and the resulting frequency is divided again. reset signal generator wtcnt (down counter) pclk wtcon[4:3] wtdat reset 1/16 1/32 1/64 1/128 8-bit prescaler wtcon[15:8] wtcon[2] wtcon[0] interrupt mux figure 18-1. watchdog timer block diagram the prescaler value and the frequency division factor are specified in the watchdog timer control (wtcon) register. valid prescaler values range from 0 to 2 8 -1. the frequency division factor can be selected as 16, 32, 64, or 128. use the following equation to calculate the watchdog timer clock frequency and the duration of each timer clock cycle: t_watchdog = 1/[ pclk / (prescaler value + 1) / division_factor ] wtdat & wtcnt once the watchdog timer is enabled, the value of watchdog timer data (wtdat) register cannot be automatically reloaded into the timer counter (wtcnt). in this reason, an initial value must be written to the watchdog timer count (wtcnt) register, before the watchdog timer starts. consideration of debugging environment when the S3C2440a is in debug mode using embedded ice, the watchdog timer must not operate. the watchdog timer can determine whether or not it is currently in the debug mode from the cpu core signal (dbgack signal). once the dbgack signal is asserted, the reset output of the watchdog timer is not activated as the watchdog timer is expired.
S3C2440a risc microprocessor watchdog timer 18- 3 watchdog timer special registers watchdog timer control (wtcon) register the wtcon register allows the user to enable/disable the watchdog timer, select the clock signal from 4 different sources, enable/disable interrupts, and enable/disable the watchdog timer output. the watchdog timer is used to resume the S3C2440a restart on mal-function after its power on; if controller restart is not desired, the watchdog timer should be disabled. if the user wants to use the normal timer provided by the watchdog timer, enable the interrupt and disable the watchdog timer. register address r/w description reset value wtcon 0x53000000 r/w watchdog timer control register 0x8021 wtcon bit description initial state prescaler value [15:8] prescaler value. the valid range is from 0 to 255(2 8 -1). 0x80 reserved [7:6] reserved. these two bits must be 00 in normal operation. 00 watchdog timer [5] enable or disable bit of watchdog timer. 0 = disable 1 = enable 1 clock select [4:3] determine the clock division factor. 00: 16 01: 32 10: 64 11: 128 00 interrupt generation [2] enable or disable bit of the interrupt. 0 = disable 1 = enable 0 reserved [1] reserved. this bit must be 0 in normal operation. 0 reset enable/disable [0] enable or disable bit of watchdog timer output for reset signal. 1: assert reset signal of the S3C2440a at watchdog time-out 0: disable the reset function of the watchdog timer. 1
watchdog timer s3c 2440a risc microprocessor 18- 4 watchdog timer data (wtdat) register the wtdat register is used to specify the time-out duration. the content of wtdat cannot be automatically loaded into the timer counter at initial watchdog timer operation. however, using 0x8000 (initial value) will drive the first time- out. in this case, the value of wtdat will be automatically reloaded into wtcnt. register address r/w description reset value wtdat 0x53000004 r/w watchdog timer data register 0x8000 wtdat bit description initial state count reload value [15:0] watchdog timer count value for reload. 0x8000 watchdog timer count (wtcnt) register the wtcnt register contains the current count values for the watchdog timer during normal operation. note that the content of the wtdat register cannot be automatically loaded into the timer count register when the watchdog timer is enabled initially, so the wtcnt register must be set to an initial value before enabling it. register address r/w description reset value wtcnt 0x53000008 r/w watchdog timer count register 0x8000 wtcnt bit description initial state count value [15:0] the current count value of the watchdog timer 0x8000
s3c24 40a risc microprocessor mmc/sd/sdio controller 19- 1 19 mmc/sd/sdio control ler features ? sd memory card spec (ver 1.0) / mmc spec(2.11) compatible ? sdio card spec (ver 1.0) compatible ? 16 words (64 bytes) fifo for data tx/rx ? 40-bit command register ? 136-bit response register ? 8-bit prescaler logic (fr eq = system clock/(p + 1)) ? normal, and dma data transfer mode(byte, halfword, word transfer) ? dma burst4 access support(only word transfer) ? 1-bit/4-bit (wide bus) mode & block/stream mode switch support block diagram cmd reg (5byte) resp reg (17byte) cmd control 8bit shift reg crc7 prescaler fifo (64byte) dat control 8bit shift reg crc16*4 dma int apb i/f 8 8 8 8 32 32 32 32 32 32 paddr psel pclk pwdata [31:0] prdata [31:0] dreq dack int txcmd rxcmd sdclk txdat[3:0] rxdat[3:0] figure 19-1. sd interface block diagram
mmc/sd/sdio controller s3c 2440 a risc microprocessor 19- 2 sd operation a serial clock line synchronizes shifting and sampling of the information on the five data lines. the transmission frequency is controlled by making the appropriate bit settings to the sdipre register. you can modify its frequency to adjust the baud rate data register value. programming procedure (common) to program the sdi modules, follow these basic steps: 1. set sdicon to configure properly with clock & interrupt enable 2. set sdipre to configure with a proper value. 3. wait 74 sdclk clock cycle in order to initialize the card. cmd path programming 1. write command argument 32bit to sdicmdarg. 2. determine command types and start command transmit with setting sdicmdcon. 3. confirm the end of sdi cmd path operation when the specific flag of sdicmdsta is set 4. the flag is cmdsent if command type is no response. 5. the flag is rspfin if command type is with response. 6. clear the flags of sdicmdsta by writing '1' to the corresponding bit. dat path programming 1. write data timeout period to sdidtimer. 2. write block size (block length) to sdibsize(normally 0x80 word). 3. determine the mode of block, wide bus, dma, etc and start data transfer with setting sdidatcon. 4. tx data ? write data to data register (sdidat) while tx fifo is available (tfdet is set), or half (tfhalf is set), or empty(tfempty is set). 5. rx data ? read data from data register (sdidat) while rx fifo is available (rfdet is set), or full (rffull is set), or half (rfhalf is set), or ready for last data(rflast is set). 6. confirm the end of sdi dat path operation when datfin flag of sdidatsta is set 7. clear the flags of sdidatsta by writing '1' to the corresponding bit.
s3c 2440a risc microprocessor mmc/sd/sdio contro ller 19- 3 sdio operation there are two functions of sdio operation: sdio interrupt receiving and read wait request generation. these two functions can operate when rcvioint bit and rwaiten bit of sdicon register is activated respectively. and two functions have the steps and conditions like below. sdio interrupt in sd 1-bit mode, interrupt is received through all range from rxdat[1] pin. in sd 4-bit mode, rxdat[1] pin is shared between data receiving and interrupt receiving. when interrupt detection range(interrupt period) is: 1. single block: the time between a and b ? a: 2clocks after the completion of a data packet ? b: the completion of sending the end bit of the next withdata command 2. multi block, prdtype = 0: the time between a and b, restart at c ? a: 2clocks after the completion of a data packet ? b: 2clocks after a ? c: 2clocks after the end bit of the abort command response 3. multi block, prdtype = 1: the time between a and b, restart at a ? a: 2clocks after the completion of a data packet ? b: 2c locks after a ? in case of last block, interrupt period begins at a, but not ends at b (cmd53 case) read wait request regardless of 1bit or 4-bit mode, read wait request signal transmits to txdat[2] pin in condition of below. ? in read multiple operation, request signal transmission begins at 2clocks after the end of the data block ? transmission ends when user sets to one rwaitreq bit of sdidatsta register
mmc/sd/sdio controller s3c 2440 a risc microprocessor 19- 4 sdi special registers sdi control register (sdicon) register address r/w description reset value sdicon 0x5a000000 r/w sdi control register 0x0 sdicon bit description initial value reserved [31:9] ? sdmmc reset (sdreset) [8] reset whole sdmmc block. this bit is automatically cleared. 0 = normal mode, 1 = sdmmc reset 0 reserved [7:6] 0 clock type (ctyp) [5] determines which clock type is used as sdclk. 0 = sd type, 1 = mmc type 0 byte order type(byteorder) [4] determines byte order type when you read(write) data from(to) sd host fifo with word boundary. 0 = type a, 1 = type b 0 receive sdio interrupt from card (rcvioint) [3] determines whether sd host receives sdio interrupt from the card or not(for sdio). 0 = ignore, 1 = receive sdio interrupt 0 read wait enable(rwaiten) [2] determines read wait request signal generate when sd host waits the next block in multiple block read mode. this bit needs to delay the next block to be transmitted from the card(for sdio). 0 = disable(no generate), 1 = read wait enable(use sdio) 0 reserved [1] clock out enable (enclk) [0] determines whether sdclk out enable or not 0 = disable (prescaler off), 1 = clock enable 0 note: byte order type type a: (access by word) d[7:0] ? d[15:8] ? d[23:16] ? d[31:24] (access by halfword) d[7:0] ? d[15:8] type b: (access by word) d[31:24] ? d[23:16] ? d[15:8] ? d[7:0] (access by halfword) d[15:8] ? d[7:0] sdi baud rate prescaler register (sdipre) register address r/w description reset value sdipre 0x5a000004 r/w sdi buad rate prescaler register 0x01 sdipre bit description initial value prescaler value [7:0] determines sdi clock(sdclk) rate as above equation. baud rate = pclk / (prescaler value + 1) 0x01 note: prescaler value should be greater than zero.
s3c 2440a risc microprocessor mmc/sd/sdio contro ller 19- 5 sdi command argument register ( sdicmdarg ) register address r/w description reset value sdicmdarg 0x5a000008 r/w sdi command argument register 0x0 sdicmdarg bit description initial value cmdarg [31:0] command argument 0x00000000 sdi command control register ( sdicmdcon ) register address r/w description reset value sdicmdcon 0x5a00000c r/w sdi command control register 0x0 sdicommand bit description initial value reserved [31:13] ? abort command (abortcmd) [12] determines whether command type is for abort (for sdio). 0 = normal command, 1 = abort command (cmd12, cmd52) 0 command with data (withdata) [11] determines whether command type is with data(for sdio). 0 = without data, 1 = with data 0 longrsp [10] determines whether host receives a 136-bit long response or not 0 = short response, 1 = long response 0 waitrsp [9] determines whether host waits for a response or not 0 = no response, 1 = wait response 0 command start(cmst) [8] determines whether command operation starts or not. . this bit is automatically cleared. 0 = command ready, 1 = command start 0 cmdindex [7:0] command index with start 2-bit (8-bit) 0x00
mmc/sd/sdio controller s3c 2440 a risc microprocessor 19- 6 sdi command status register ( sdicmdsta ) register address r/w description reset value sdicmdsta 0x5a000010 r/(c) sdi command status register 0x0 sdicmdsta bit description initial value reserved [31:13] ? ? response crc fail(rspcrc) [12] r/c crc check failed when command response received. this flag is cleared by setting to one this bit. 0 = not detect, 1 = crc fail 0 command sent (cmdsent) [11] r/c command sent(not concerned with response). this flag is cleared by setting to one this bit. 0 = not detect, 1 = command end 0 command time out (cmdtout) [10] r/c command response timeout (64clk). this flag is cleared by setting to one this bit. 0 = not detect, 1 = timeout 0 response receive end (rspfin) [9] r/c command response received. this flag is cleared by setting to one this bit. 0 = not detect, 1 = response end 0 cmd line progress on (cmdon) [8] command transfer in progress 0 = not detect, 1 = in progress 0 rspindex [7:0] response index 6-bit with start 2-bit (8-bit) 0x00 sdi response register 0 (sdirsp0) register address r/w description reset value sdirsp0 0x5a000014 r sdi response register 0 0x0 sdirsp0 bit description initial value response0 [31:0] card status[31:0](short), card status[127:96](long) 0x00000000 sdi response register 1 (sdirsp1) register address r/w description reset value sdirsp1 0x5a000018 r sdi response register 1 0x0 sdirsp1 bit description initial value rcrc7 [31:24] crc7(with end bit, short), card status[95:88](long) 0x00 response1 [23:0] unused(short), card status[87:64](long) 0x000000
s3c 2440a risc microprocessor mmc/sd/sdio contro ller 19- 7
mmc/sd/sdio controller s3c 2440 a risc microprocessor 19- 8 sdi response register 2 (sdirsp2) register address r/w description reset value sdirsp2 0x5a00001c r sdi response register 2 0x0 sdirsp2 bit description initial value response2 [31:0] unused(short), card status[63:32](long) 0x00000000 sdi response register 3 ( sdirsp3 ) register address r/w description reset value sdirsp3 0x5a000020 r sdi response register 3 0x0 sdirsp3 bit description initial value response3 [31:0] unused(short), card status[31:0](long) 0x00000000 sdi data / busy timer register ( sdidtimer ) register address r/w description reset value sdidtimer 0x5a000024 r/w sdi data / busy timer register 0x0 sdidtimer bit description initial value reserved [31:23] ? ? datatimer [22:0] data / busy timeout period 0x10000 sdi block size register ( sdibsize ) register address r/w description reset value sdibsize 0x5a000028 r/w sdi block size register 0x0 sdibsize bit description initial value reserved [31:12] ? ? blksize [11:0] block size value (0~4095 byte), don?t care when stream mode 0x000 note: in case of multi block, blksize must be aligned to word(4byte) size.(blksize[1:0] = 00)
s3c 2440a risc microprocessor mmc/sd/sdio contro ller 19- 9 sdi data control register ( sdidatcon ) register address r/w description reset value sdidatcon 0x5a00002c r/w sdi data control register 0x0 sdidatcon bit description initial value reserved [31:25] ? ? burst4 enable (burst4) [24] enable burst4 mode in dma mode. this bit should be set only when data size is word. 0 = disable, 1 = burst4 enable 0 data size (datasize) [23:22] indicates the size of the transfer with fifo, which is typically byte, halfword or word. 00 = byte transfer, 01 = halfword transfer 10 = word transfer, 11 = reserved 0 sdio interrupt period type (prdtype) [21] determines whether sdio interrupt period is 2 cycle or extend more cycle when data block last is transferred (for sdio). 0 = exactly 2 cycle, 1 = more cycle (likely single block) 0 transmit after response (tarsp) [20] determines when data transmit start after response receive or not 0 = directly after datmode set, 1 = after response receive (assume datmode sets to 2?b11) 0 receive after command (racmd) [19] determines when data receive start after command sent or not 0 = directly after datmode set, 1 = after command sent (assume datmode sets to 2?b10) 0 busy after command (bacmd) [18] determines when busy receive start after command sent or not 0 = directly after datmode set, 1 = after command sent (assume datmode sets to 2?b01) 0 block mode (blkmode) [17] data transfer mode 0 = stream data transfer, 1 = block data transfer 0 wide bus enable (widebus) [16] determines enable wide bus mode 0 = standard bus mode(only sdidat[0] used), 1 = wide bus mode(sdidat[3:0] used) 0 dma enable (endma) [15] enable dma 0 = disable(polling), 1 = dma enable when dma operation is completed, this bit should be disabled. 0 data transfer start(dtst) [14] determines whether data transfer start or not. . this bit is auto- matically cleared. 0 = data ready, 1 = data start 0 data transfer mode (datmode) [13:12] determines which direction of data transfer 00 = no operation, 01 = only busy check mode 10 = data receive mode, 11 = data transmit mode 00 blknum [11:0] block number (0~4095), don?t care when stream mode 0x000 note: if you want one of tarsp, racmd, bacmd bits(sdidatcon[20:18]) to ?1?, you need to write on sdidatcon register ahead of on sdicmdcon register.(always need for sdio)
mmc/sd/sdio controller s3c 2440 a risc microprocessor 19- 10
s3c 2440a risc microprocessor mmc/sd/sdio contro ller 19- 11 sdi data remain counter register ( adidatcnt ) register address r/w description reset value sdidatcnt 0x5a000030 r sdi data remain counter register 0x0 sdidatcnt bit description initial value reserved [31:24] ? ? blknumcnt [23:12] remaining block number 0x000 blkcnt [11:0] remaining data byte of 1 block 0x000 sdi data status register ( adidatsta ) register address r/w description reset value sdidatsta 0x5a000034 r/(c) sdi data status register 0x0 sdidatsta bit description initial value reserved [31:12] ? ? no busy (nobusy) [11] r/c busy is not active during 16cycle after cmd packet transmitted in only busy check mode. this flag is cleared by setting to 1 this bit. 0 = not detect, 1 = no busy signal 0 read wait request occur (rwaitreq) [10] r/c read wait request signal transmits to sd card. the request signal is stopped and this flag is cleared by setting to one this bit. 0 = not occur, 1 = read wait request occur 0 sdio interrupt detect (iointdet) [9] r/c sdio interrupt detect. this flag is cleared by setting to one this bit. 0 = not detect, 1 = sdio interrupt detect 0 reserved [8] ? crc status fail (crcsta) [7] r/c crc status error when data block sent(crc check failed). this flag is cleared by setting to one this bit. 0 = not detect, 1 = crc status fail 0 data receive crc fail (datcrc) [6] r/c data block received error(crc check failed). this flag is cleared by setting to one this bit. 0 = not detect, 1 = receive crc fail 0 data time out (dattout) [5] r/c data / busy receive timeout. this flag is cleared by setting to one this bit. 0 = not detect, 1 = timeout 0 data transfer finish (datfin) [4] r/c data transfer completes(data counter is zero). this flag is cleared by setting to one this bit. 0 = not detect, 1 = data finish detect 0 busy finish (busyfin) [3] r/c only busy check finish. this flag is cleared by setting to one this bit 0 = not detect, 1 = busy finish detect 0 reserved [2] 0 tx data progress on (txdaton) [1] data transmit in progress 0 = not active, 1 = data tx in progress 0 rx data progress on (rxdaton) [0] data receive in progress 0 = not active, 1 = data rx in progress 0
mmc/sd/sdio controller s3c 2440 a risc microprocessor 19- 12 sdi fifo status register (sdifsta) register address r/w description reset value sdifsta 0x5a000038 r/(c) sdi fifo status register 0x0 sdifsta bit description initial state reserved [31:16] ? ? fifo reset(frst) [16] c reset fifo value. this bit is automatically cleared. 0 = normal mode, 1 = fifo reset 0 fifo fail error (fffail) [15:14] r/c fifo fail error when fifo occurs overrun / underrun data saving. this flag is cleared by setting to one these bits. 00 = not detect, 01 = fifo fail 10 = fifo fail in the last transfer (only fifo reset need) 11 = reserved 0 fifo available detect for tx (tfdet) [13] this bit indicates that fifo data is available for transmit when datmode is data transmit mode. if dma mode is enable, sd host requests dma operation. 0 = not detect(fifo full), 1 = detect (0 fifo 63) 0 fifo available detect for rx (rfdet) [12] this bit indicates that fifo data is available for receive when datmode is data receive mode. if dma mode is enable, sd host requests dma operation. 0 = not detect(fifo empty), 1 = detect (1 fifo 64) 0 tx fifo half full (tfhalf) [11] this bit sets to 1 whenever tx fifo is less than 33byte. 0 = 33 tx fifo 64, 1 = 0 tx fifo 32 0 tx fifo empty (tfempty) [10] this bit sets to 1 whenever tx fifo is empty. 0 = 1 tx fifo 64, 1 = empty (0byte) 0 rx fifo last data ready (rflast) [9] r/c this bit sets to 1 when rx fifo occurs to behave last data of all block. this flag is cleared by setting to one this bit. 0 = not received yet, 1 = rx fifo gets last data 0 rx fifo full (rffull) [8] this bit sets to 1 whenever rx fifo is full. 0 = 0 rx fifo 63, 1 = full (64byte) 0 rx fifo half full (rfhalf) [7] this bit sets to 1 whenever rx fifo is more than 31byte. 0 = 0 rx fifo 31, 1 = 32 rx fifo 64 0 fifo count (ffcnt) [6:0] number of data(byte) in fifo 0000000 note: although the last rx data size is lager than remained count of fifo data, you could read this data. if this eve nt happens, you should clear fffail field, and fifo reset field
s3c 2440a risc microprocessor mmc/sd/sdio contro ller 19- 13 sdi interrupt mask register ( sdiintmsk ) register address r/w description reset value sdiintmsk 0x5a00003c r/w sdi interrupt mask register 0x0 sdiintmsk bit description initial value reserved [31:19] ? ? nobusy interrupt enable (nobusyint) [18] determines sdi generate an interrupt if busy signal is not active 0 = disable, 1 = interrupt enable 0 rspcrc interrupt enable (rspcrcint) [17] determines sdi generate an interrupt if response crc check fails 0 = disable, 1 = interrupt enable 0 cmdsent interrupt enable (cmdsentint) [16] determines sdi generate an interrupt if command sent(no response required) 0 = disable, 1 = interrupt enable 0 cmdtout interrupt enable (cmdtoutint) [15] determines sdi generate an interrupt if command response timeout occurs 0 = disable, 1 = interrupt enable 0 rspend interrupt enable (rspendint) [14] determines sdi generate an interrupt if command response received 0 = disable, 1 = interrupt enable 0 rwaitreq interrupt enable (rwreqint) [13] determines sdi generate an interrupt if read wait request occur. 0 = disable, 1 = interrupt enable 0 iointdet interrupt enable (intdetint) [12] determines sdi generate an interrupt if sd host receives sdio interrupt from the card(for sdio). 0 = disable, 1 = interrupt enable 0 fffail interrupt enable (fffailint) [11] determines sdi generate an interrupt if fifo fail error occurs 0 = disable, 1 = interrupt enable 0 crcsta interrupt enable (crcstaint) [10] determines sdi generate an interrupt if crc status error occurs 0 = disable, 1 = interrupt enable 0 datcrc interrupt enable (datcrcint) [9] determines sdi generate an interrupt if data receive crc failed 0 = disable, 1 = interrupt enable 0 dattout interrupt enable (dattoutint) [8] determines sdi generate an interrupt if data receive timeout occurs 0 = disable, 1 = interrupt enable 0 datfin interrupt enable (datfinint) [7] determines sdi generate an interrupt if data counter is zero 0 = disable, 1 = interrupt enable 0
mmc/sd/sdio controller s3c 2440 a risc microprocessor 19- 14 sdi interrupt mask register ( sdiintmsk ) ( continued ) sdiintmsk bit description initial value busyfin interrupt enable (busyfinint) [6] determines sdi generate an interrupt if only busy check completes 0 = disable, 1 = interrupt enable 0 reserved [5] ? 0 tfhalf interrupt enable (tfhalfint) [4] determines sdi generate an interrupt if tx fifo fills half 0 = disable, 1 = interrupt enable 0 tfempty interrupt enable (tfemptint) [3] determines sdi generate an interrupt if tx fifo is empty 0 = disable, 1 = interrupt enable 0 rflast interrupt enable (rflastint) [2] determines sdi generate an interrupt if rx fifo has last data 0 = disable, 1 = interrupt enable 0 rffull interrupt enable (rffullint) [1] determines sdi generate an interrupt if rx fifo fills full 0 = disable, 1 = interrupt enable 0 rfhalf interrupt enable (rfhalfint) [0] determines sdi generate an interrupt if rx fifo fills half 0 = disable, 1 = interrupt enable 0 sdi data register (sdidat) register address r/w description reset value sdidat 0x5a000040, 44, 48, 4c(li/w, li/hw, li/b, bi/w) 0x5a000041(bi/hw), 0x5a000043(bi/b) r/w sdi data register 0x0 sdidat bit description initial state data register [31:0] this field contains the data to be transmitted or received over the sdi channel 0x00000000 note: ? (li/w, li/hw, li/b): access by word/halfword//byte unit when endian mode is little ? (bi/w): access by word unit when endian mode is big ? (bi/hw): access by halfword unit when endian mode is big ? (bi/b): access by byte unit when endian mode is big
S3C2440a risc microprocessor iic-bus interface 20- 1 20 iic-bus interface overview the S3C2440a risc microprocessor can support a multi-master iic-bus serial interface. a dedicated serial data line (sda) and a serial clock line (scl) carry information between bus masters and peripheral devices which are connected to the iic-bus. the sda and scl lines are bi-directional. in multi-master iic-bus mode, multiple S3C2440a risc microprocessors can receive or transmit serial data to or from slave devices. the master S3C2440a can initiate and terminate a data transfer over the iic-bus. the iic-bus in the S3C2440a uses standard bus arbitration procedure. to control multi-master iic-bus operations, values must be written to the following registers: ? multi-master iic-bus control register, iiccon ? multi-master iic-bus control/status register, iicstat ? multi-master iic-bus tx/rx data shift register, iicds ? multi-master iic-bus address register, iicadd when the iic-bus is free, the sda and scl lines should be both at high level. a high-to-low transition of sda can initiate a start condition. a low-to-high transition of sda can initiate a stop condition while scl remains steady at high level. the start and stop conditions can always be generated by the master devices. a 7-bit address value in the first data byte, which is put onto the bus after the start condition has been initiated, can determine the slave device which the bus master device has selected. the 8th bit determines the direction of the transfer (read or write). every data byte put onto the sda line should be eight bits in total. the bytes can be unlimitedly sent or received during the bus transfer operation. data is always sent from most-significant bit (msb) first, and every byte should be immediately followed by acknowledge (ack) bit.
iic-bus interface S3C2440a risc microprocessor 20- 2 pclk address register sda 4-bit prescaler iic-bus control logic iicstat iiccon comparator shift register shift register (iicds) data bus scl figure 20-1. iic-bus block diagram
S3C2440a risc microprocessor iic-bus interface 20- 3 iic-bus interface the S3C2440a iic-bus interface has four operation modes: ? master transmitter mode ? master receive mode ? slave transmitter mode ? slave receive mode functional relationships among these operating modes are described below. start and stop conditions when the iic-bus interface is inactive, it is usually in slave mode. in other words, the interface should be in slave mode before detecting a start condition on the sda line (a start condition can be initiated with a high-to-low transition of the sda line while the clock signal of scl is high). when the interface state is changed to master mode, a data transfer on the sda line can be initiated and scl signal generated. a start condition can transfer a one-byte serial data over the sda line, and a stop condition can terminate the data transfer. a stop condition is a low-to-high transition of the sda line while scl is high. start and stop conditions are always generated by the master. the iic-bus gets busy when a start condition is generated. a stop condition will make the iic-bus free. when a master initiates a start condition, it should send a slave address to notify the slave device. one byte of address field consists of a 7-bit address and a 1-bit transfer direction indicator (showing write or read). if bit 8 is 0, it indicates a write operation (transmit operation); if bit 8 is 1, it indicates a request for data read (receive operation). the master will complete the transfer operation by transmitting a stop condition. if the master wants to continue the data transmission to the bus, it should generate another start condition as well as a slave address. in this way, the read-write operation can be performed in various formats. scl sda sda scl start condition stop condition figure 20-2. start and stop condition
iic-bus interface S3C2440a risc microprocessor 20- 4 data transfer format every byte placed on the sda line should be eight bits in length. the bytes can be unlimitedly transmitted per transfer. the first byte following a start condition should have the address field. the address field can be transmitted by the master when the iic-bus is operating in master mode. each byte should be followed by an acknowledgement (ack) bit. the msb bit of the serial data and addresses are always sent first. notes: 1. s: start, rs: repeat start, p: stop, a: acknowledge 2. : from master to slave, : from slave to master write mode format with 7-bit addresses "0" (write) data transferred (data + acknowledge) s slave address 7bits r/w a p data(1byte) a read mode format with 7-bit addresses "1" (read) data transferred (data + acknowledge) s slave address 7 bits r/w a p data a write mode format with 10-bit addresses "0" (write) data transferred (data + acknowledge) p data a s slave address 1st 7 bits r/w a slave address 2nd byte a 11110xx read mode format with 10-bit addresses "1" (read) s slave address 1st 7 bits 11110xx r/w a slave address 2nd byte a rs slave address 1st 7 bits a data transferred (data + acknowledge) p data a r/w "1" (read) figure 20-3. iic-bus interface data format
S3C2440a risc microprocessor iic-bus interface 20- 5 sda acknowledgement signal from receiver scl s 1 2 7 8 9 1 2 9 acknowledgement signal from receiver msb ack byte complete, interrupt within receiver clock line held low by receiver and/or transmitter figure 20-4. data transfer on the iic-bus ack signal transmission to complete a one-byte transfer operation, the receiver should send an ack bit to the transmitter. the ack pulse should occur at the ninth clock of the scl line. eight clocks are required for the one-byte data transfer. the master should generate the clock pulse required to transmit the ack bit. the transmitter should release the sda line by making the sda line high when the ack clock pulse is received. the receiver should also drive the sda line low during the ack clock pulse so that the sda keeps low during the high period of the ninth scl pulse. the ack bit transmit function can be enabled or disabled by software (iicstat). however, the ack pulse on the ninth clock of scl is required to complete the one-byte data transfer operation. data output by transmitter data output by receiver scl from master start condition clock pulse for acknowledgment clock to output 9 8 7 s 1 2 figure 20-5. acknowledge on the iic-bus
iic-bus interface S3C2440a risc microprocessor 20- 6 read-write operation in transmitter mode, when the data is transferred, the iic-bus interface will wait until iic-bus data shift (iicds) register receives a new data. before the new data is written into the register, the scl line will be held low, and then released after it is written. the S3C2440a should hold the interrupt to identify the completion of current data transfer. after the cpu receives the interrupt request, it should write a new data into the iicds register, again. in receive mode, when data is received, the iic-bus interface will wait until iicds register is read. before the new data is read out, the scl line will be held low and then released after it is read. the S3C2440a should hold the interrupt to identify the completion of the new data reception. after the cpu receives the interrupt request, it should read the data from the iicds register. bus arbitration procedures arbitration takes place on the sda line to prevent the contention on the bus between two masters. if a master with a sda high level detects the other master with a sda active low level, it will not initiate a data transfer because the current level on the bus does not correspond to its own. the arbitration procedure will be extended until the sda line turns high. however, when the masters simultaneously lower the sda line, each master should evaluate whether the mastership is allocated itself or not. for the purpose of evaluation is that each master should detect the address bits. while each master generates the slaver address, it should also detect the address bit on the sda line because the sda line is likely to get low rather than to keep high. assume that one master generates a low as first address bit, while the other master is maintaining high. in this case, both masters will detect low on the bus because the low status is superior to the high status in power. when this happens, low (as the first bit of address) generating master will get the mastership while high (as the first bit of address) generating master should withdraw the mastership. if both masters generate low as the first bit of address, there should be arbitration for the second address bit, again. this arbitration will continue to the end of last address bit. abort conditions if a slave receiver cannot acknowledge the confirmation of the slave address, it should hold the level of the sda line high. in this case, the master should generate a stop condition and to abort the transfer. if a master receiver is involved in the aborted transfer, it should signal the end of the slave transmit operation by canceling the generation of an ack after the last data byte received from the slave. the slave transmitter should then release the sda to allow a master to generate a stop condition. configuring iic-bus to control the frequency of the serial clock (scl), the 4-bit prescaler value can be programmed in the iiccon register. the iic-bus interface address is stored in the iic-bus address (iicadd) register. (by default, the iic-bus interface address has an unknown value.)
S3C2440a risc microprocessor iic-bus interface 20- 7 flowcharts of operations in each mode the following steps must be executed before any iic tx/rx operations. 1. write own slave address on iicadd register, if needed. 2. set iiccon register. a) enable interrupt b) define scl period 3. set iicstat to enable serial output write slave address to iicds. write 0xf0 (m/t start) to iicstat. the data of the iicds is transmitted. ack period and then interrupt is pending. write 0xd0 (m/t stop) to iicstat. write new data transmitted t o iicds. stop? clear pending bit to resume. the data of the iicds is shifted to sda. start master tx mode has been configured. clear pending bit . wait until the stop condition takes effect. end y n figure 20-6. operations for master/transmitter mode
iic-bus interface S3C2440a risc microprocessor 20- 8 write slave address to iicds. write 0xb0 (m/r start) to iicstat. the data of the iicds (slave address) is transmitted. ack period and then interrupt is pending. write 0x90 (m/r stop) to iicstat. read a new data from iicds. stop? clear pending bit to resume. sda is shifted to iicds. start master rx mode has been configured. clear pending bit . wait until the stop condition takes effect. end y n figure 20-7. operations for master/receiver mode
S3C2440a risc microprocessor iic-bus interface 20- 9 iic detects start signal. and, iicds receives data. iic compares iicadd and iicds (the received slave address). write data to iicds. the iic address match interrupt is generated. clear pending bit to resume. the data of the iicds is shifted to sda. start slave tx mode has been configured. end matched? n y stop? interrupt is pending. n y figure 20-8. operations for slave/transmitter mode
iic-bus interface S3C2440a risc microprocessor 20- 10 iic detects start signal. and, iicds receives data. iic compares iicadd and iicds (the received slave address). read data from iicds. the iic address match interrupt is generated. clear pending bit to resume. sda is shifted to iicds. start slave rx mode has been configured. end matched? n y stop? interrupt is pending. n y figure 20-9. operations for slave/receiver mode
S3C2440a risc microprocessor iic-bus interface 20- 11 iic-bus interface special registers multi-master iic-bus control (iiccon) register register address r/w description reset value iiccon 0x54000000 r/w iic-bus control register 0x0x iiccon bit description initial state acknowledge generation (1) [7] iic-bus acknowledge enable bit. 0: disable 1: enable in tx mode, the iicsda is free in the ack time. in rx mode, the iicsda is l in the ack time. 0 tx clock source selection [6] source clock of iic-bus transmit clock prescaler selection bit. 0: iicclk = fpclk /16 1: iicclk = fpclk /512 0 tx/rx interrupt (5) [5] iic-bus tx/rx interrupt enable/disable bit. 0: disable, 1: enable 0 interrupt pending flag (2) (3) [4] iic-bus tx/rx interrupt pending flag. this bit cannot be written to 1. when this bit is read as 1, the iicscl is tied to l and the iic is stopped. to resume the operation, clear this bit as 0. 0: 1) no interrupt pending (when read). 2) clear pending condition & resume the operation (when write). 1: 1) interrupt is pending (when read) 2) n/a (when write) 0 transmit clock value (4) [3:0] iic-bus transmit clock prescaler. iic-bus transmit clock frequency is determined by this 4-bit prescaler value, according to the following formula: tx clock = iicclk/(iiccon[3:0]+1). undefined notes: 1. interfacing with eeprom, the ack generation may be disabled before reading the last data in order to generate the stop condition in rx mode. 2. an iic-bus interrupt occurs 1) when a 1-byte transmits or receive operation is completed, 2) when a general call or a slave address match occurs, or 3) if bus arbitration fails. 3. to adjust the setup time of sda before scl rising edge, iicds has to be written before clearing the iic interrupt pending bit. 4. i icclk is determined by iiccon[6]. tx clock can vary by scl transition time. when iiccon[6]=0, iiccon[3:0]=0x0 or 0x1 is not available. 5. if the iiccon[5]=0, iiccon[4] does not operate correctly. so, it is recommended that you should set iiccon[5]=1, although you does not use the iic interrupt.
iic-bus interface S3C2440a risc microprocessor 20- 12 multi-master iic-bus control/status (iicstat) register register address r/w description reset value iicstat 0x54000004 r/w iic-bus control/status register 0x0 iicstat bit description initial state mode selection [7:6] iic-bus master/slave tx/rx mode select bits. 00: slave receive mode 01: slave transmit mode 10: master receive mode 11: master transmit mode 00 busy signal status / start stop condition [5] iic-bus busy signal status bit. 0: read) not busy (when read) write) stop signal generation 1: read) busy (when read) write) start signal generation. the data in iicds will be transferred automatically just after the start signal. 0 serial output [4] iic-bus data output enable/disable bit. 0: disable rx/tx, 1: enable rx/tx 0 arbitration status flag [3] iic-bus arbitration procedure status flag bit. 0: bus arbitration successful 1: bus arbitration failed during serial i/o 0 address-as-slave status flag [2] iic-bus address-as-slave status flag bit. 0: cleared when start/stop condition was detected 1: received slave address matches the address value in the iicadd 0 address zero status flag [1] iic-bus address zero status flag bit. 0: cleared when start/stop condition was detected 1: received slave address is 00000000b. 0 last-received bit status flag [0] iic-bus last-received bit status flag bit. 0: last-received bit is 0 (ack was received). 1: last-received bit is 1 (ack was not received). 0
S3C2440a risc microprocessor iic-bus interface 20- 13 multi-master iic-bus address (iicadd) register register address r/w description reset value iicadd 0x54000008 r/w iic-bus address register 0xxx iicadd bit description initial state slave address [7:0] 7-bit slave address, latched from the iic-bus. when serial output enable = 0 in the iicstat, iicadd is write- enabled. the iicadd value can be read any time, regardless of the current serial output enable bit (iicstat) setting. slave address : [7:1] not mapped : [0] xxxxxxxx multi-master iic-bus transmit/receive data shift (iicds) register register address r/w description reset value iicds 0x5400000c r/w iic-bus transmit/receive data shift register 0xxx iicds bit description initial state data shift [7:0] 8-bit data shift register for iic-bus tx/rx operation. when serial output enable = 1 in the iicstat, iicds is write- enabled. the iicds value can be read any time, regardless of the current serial output enable bit (iicstat) setting. xxxxxxxx
iic-bus interface S3C2440a risc microprocessor 20- 14 multi-master iic-bus line control(iiclc) register register address r/w description reset value iiclc 0x54000010 r/w iic-bus multi-master line control register 0x00 iiclc bit description initial state filter enable [2] iic-bus filter enable bit. when sda port is operating as input, this bit should be high. this filter can prevent from occurred error by a glitch during double of pclk time. 0: filter disable 1: filter enable 0 sda output delay [1:0] iic-bus sda line delay length selection bits. sda line is delayed as following clock time(pclk) 00: 0 clocks 01: 5 clocks 10: 10 clocks 11: 15 clocks 00
S3C2440a risc microprocessor iis-bus interface 21- 1 21 iis-bus interface overview currently, many digital audio systems are attracting the consumers on the market, in the form of compact discs, digital audio tapes, digital sound processors, and digital tv sound. the S3C2440a inter-ic sound (iis) bus interface can be used to implement a codec interface to an external 8/16-bit stereo audio codec ic for mini-disc and portable applications. the iis bus interface supports both iis bus data format and msb-justified data format. the interface provides dma transfer mode for fifo access instead of an interrupt. it can transmit and receive data simultaneously as well as transmit or receive data alternatively at a time.
iis-bus interface S3C2440a risc microprocessor 21- 2 block diagram addr data cntl pclk brfc ipsr_a ipsr_b txfifo rxfifo sclkg chnc sftr lrck sclk sd cdclk mpllin figure 21-1. iis-bus block diagram functional descriptions bus interface, register bank, and state machine (brfc): bus interface logic and fifo access are controlled by the state machine. 5-bit dual prescaler (ipsr): one prescaler is used as the master clock generator of the iis bus interface and the other is used as the external codec clock generator. 64-byte fifos (txfifo and rxfifo): in transmit data transfer, data are written to txfifo, and, in the receive data transfer, data are read from rxfifo. master iisclk generator (sclkg): in master mode, serial bit clock is generated from the master clock. channel generator and state machine (chnc): iisclk and iislrck are generated and controlled by the channel state machine. 16-bit shift register (sftr): parallel data is shifted to serial data output in the transmit mode, and serial data input is shifted to parallel data in the receive mode. transmit or receive only mode normal transfer iis control register has fifo ready flag bits for transmit and receive fifos. when fifo is ready to transmit data, the fifo ready flag is set to '1' if transmit fifo is not empty. if transmit fifo is empty, fifo ready flag is set to '0'. while receiving fifo is not full, the fifo ready flag for receive fifo is set to '1' ; it indicates that fifo is ready to receive data. if receive fifo is full, fifo ready flag is set to '0'. these flags can determine the time that cpu is to write or read fifos. serial data can be transmitted or received while the cpu is accessing transmit and receive fifos in this way.
S3C2440a risc microprocessor iis-bus interface 21- 3 dma transfer in this mode, transmit or receive fifo is accessible by the dma controller. dma service request in transmit or receive mode is made by the fifo ready flag automatically. transmit and receive mode in this mode, iis bus interface can transmit and receive data simultaneously. audio serial interface format iis-bus format the iis bus has four lines including serial data input (iisdi), serial data output (iisdo), left/right channel select (iislrck), and serial bit clock (iisclk); the device generating iislrck and iisclk is the master. serial data is transmitted in 2's complement with the msb first. the msb is transmitted first because the transmitter and receiver may have different word lengths. the transmitter does not have to know how many bits the receiver can handle, nor does the receiver need to know how many bits are being transmitted. when the system word length is greater than the transmitter word length, the word is truncated (least significant data bits are set to '0') for data transmission. if the receiver gets more bits than its word length, the bits after the lsb are ignored. on the other hand, if the receiver gets fewer bits than its word length, the missing bits are set to zero internally. and therefore, the msb has a fixed position, whereas the position of the lsb depends on the word length. the transmitter sends the msb of the next word at one clock period whenever the iislrck is changed. serial data sent by the transmitter may be synchronized with either the trailing (high to low) or the leading (low to high) edge of the clock signal. however, the serial data must be latched into the receiver on the leading edge of the serial clock signal, and so there are some restrictions when transmitting data that is synchronized with the leading edge. the lr channel select line indicates the channel being transmitted. iislrck may be changed either on a trailing or leading edge of the serial clock, but it does not need to be symmetrical. in the slave, this signal is latched on the leading edge of the clock signal. the iislrck line changes one clock period before the msb is transmitted. this allows the slave transmitter to derive synchronous timing of the serial data that will be set up for transmission. furthermore, it enables the receiver to store the previous word and clear the input for the next word. msb (left) justified msb / left justified bus format is the same as iis bus format architecturally. only, different from the iis bus format, the msb justified format realizes that the transmitter always sends the msb of the next word whenever the iislrck is changed.
iis-bus interface S3C2440a risc microprocessor 21- 4 iis-bus format (n=8 or 16) msb (1st) 2nd bit n-1th bit lsb (last) msb (1st) 2nd bit n-1th bit lsb (last) msb (1st) lrck sclk sd left right left msb-justified format (n=8 or 16) 2nd bit n-1th bit lsb (last) msb (1st) 2nd bit n-1th bit lsb (last) lrck sclk sd left right msb (1st) figure 21-2. iis-bus and msb (left)-justified data interface formats sampling frequency and master clock master clock frequency (pclk or mpllin) can be selected by sampling frequency as shown in table 21-1. because master clock is made by iis prescaler, the prescaler value and master clock type (256 or 384fs) should be determined properly. serial bit clock frequency type (16/32/48fs) can be selected by the serial bit per channel and master clock as shown in table 21-2. table 21-1. codec clock (codeclk = 256 or 384fs) iislrck (fs) 8.000 khz 11.025 khz 16.000 khz 22.050 khz 32.000 khz 44.100 khz 48.000 khz 64.000 khz 88.200 khz 96.000 khz 256fs codeclk 2.0480 2.8224 4.0960 5.6448 8.1920 11.2896 12.2880 16.3840 22.5792 24.5760 (mhz) 384fs 3.0720 4.2336 6.1440 8.4672 12.2880 16.9344 18.4320 24.5760 33.8688 36.8640 table 21-2. usable serial bit clock frequency (iisclk = 16 or 32 or 48fs) serial bit per channel 8-bit 16-bit serial clock frequency (iisclk) @codeclk = 256fs 16fs, 32fs 32fs @codeclk = 384fs 16fs, 32fs, 48fs 32fs, 48fs
S3C2440a risc microprocessor iis-bus interface 21- 5 iis-bus interface special registers iis control (iiscon) register register address r/w description reset value iiscon 0x55000000 (li/hw, li/w, bi/w) 0x55000002 (bi/hw) r/w iis control register 0x100 iiscon bit description initial state left/right channel index (read only) [8] 0 = left 1 = right 1 transmit fifo ready flag (read only) [7] 0 = empty 1 = not empty 0 receive fifo ready flag (read only) [6] 0 = full 1 = not full 0 transmit dma service request [5] 0 = disable 1 = enable 0 receive dma service request [4] 0 = disable 1 = enable 0 transmit channel idle command [3] in idle state the iislrck is inactive (pause tx). 0 = not idle 1 = idle 0 receive channel idle command [2] in idle state the iislrck is inactive (pause rx). 0 = not idle 1 = idle 0 iis prescaler [1] 0 = disable 1 = enable 0 iis interface [0] 0 = disable (stop) 1 = enable (start) 0 notes: 1. the iiscon register is accessible for each byte, halfword and word unit using strb/strh/str and ldrb/ldrh/ldr instructions or char/short int/int type pointer in little/big endian mode. 2. (li/hw/w) : little/halfword/word (bi/hw/w) : big/halfword/word
iis-bus interface S3C2440a risc microprocessor 21- 6 iis mode register (iismod) register register address r/w description reset value iismod 0x55000004 (li/w, li/hw, bi/w) 0x55000006 (bi/hw) r/w iis mode register 0x0 iismod bit description initial state master clock select [9] master clock select 0 = pclk 1 = mpllin 0 master/slave mode select [8] 0 = master mode (iislrck and iisclk are output mode). 1 = slave mode (iislrck and iisclk are input mode). 0 transmit/receive mode select [7:6] 00 = no transfer 01 = receive mode 10 = transmit mode 11 = transmit and receive mode 00 active level of left/right channel [5] 0 = low for left channel (high for right channel) 1 = high for left channel (low for right channel) 0 serial interface format [4] 0 = iis compatible format 1 = msb (left)-justified format 0 serial data bit per channel [3] 0 = 8-bit 1 = 16-bit 0 master clock frequency select [2] 0 = 256fs 1 = 384fs (fs: sampling frequency) 0 serial bit clock frequency select [1:0] 00 = 16fs 01 = 32fs 10 = 48fs 11 = n/a 00 notes: 1. the iismod register is accessible for each halfword and wordunit using strh/str and ldrh/ldr instructions or short int/int type pointer in little/big endian mode. 2. (li/hw/w) : little/halfword/word. (bi/hw/w) : big/halfword/word.
S3C2440a risc microprocessor iis-bus interface 21- 7 iis prescaler (iispsr) register register address r/w description reset value iispsr 0x55000008 (li/hw, li/w, bi/w) 0x5500000a (bi/hw) r/w iis prescaler register 0x0 iispsr bit description initial state prescaler control a [9:5] data value: 0 ~ 31 note: prescaler a makes the master clock that is used the internal block and division factor is n+1. 00000 prescaler control b [4:0] data value: 0 ~ 31 note: prescaler b makes the master clock that is used the external block and division factor is n+1. 00000 notes: 1. the iispsr register is accessible for each byte, halfword and word unit using strb/strh/str and ldrb/ldrh/ldr instructions or char/short int/int type pointer in little/big endian mode. 2. (li/hw/w): little/halfword/word. (bi/hw/w): big/halfword/word.
iis-bus interface S3C2440a risc microprocessor 21- 8 iis fifo control (iisfcon) register register address r/w description reset value iisfcon 0x5500000c (li/hw, li/w, bi/w) 0x5500000e (bi/hw) r/w iis fifo interface register 0x0 iisfcon bit description initial state transmit fifo access mode select [15] 0 = normal 1 = dma 0 receive fifo access mode select [14] 0 = normal 1 = dma 0 transmit fifo [13] 0 = disable 1 = enable 0 receive fifo [12] 0 = disable 1 = enable 0 transmit fifo data count (read only) [11:6] data count value = 0 ~ 32 000000 receive fifo data count (read only) [5:0] data count value = 0 ~ 32 000000 notes: 1. the iisfcon register is accessible for each halfword and word unit using strh/str and ldrh/ldr instructions or short int/int type pointer in little/big endian mode. 2. (li/hw/w): little/halfword/word. (bi/hw/w): big/halfword/word. iis fifo (iisfifo) register iis bus interface contains two 64-byte fifo for the transmit and receive mode. each fifo has 16-width and 32-depth form, which allows the fifo to handles data for each halfword unit regardless of valid data size. transmit and receive fifo access is performed through fifo entry; the address of fentry is 0x55000010. register address r/w description reset value iisfifo 0x55000010(li/hw) 0x55000012(bi/hw) r/w iis fifo register 0x0 iisfif bit description initial state fentry [15:0] transmit/receive data for iis 0x0 notes: 1. the iisfifo register is accessible for each halfword and word unit using strh and ldrh instructions or short int type pointer in little/big endian mode. 2. (li/hw): little/halfword. (bi/hw): big/halfword.
S3C2440a risc microprocessor spi 22- 1 22 spi overview the S3C2440a serial peripheral interface (spi) can interface with the serial data transfer. the S3C2440a includes two spi, each of which has two 8-bit shift registers for transmission and receiving, respectively. during an spi transfer, data is simultaneously transmitted (shifted out serially) and received (shifted in serially). 8-bit serial data at a frequency is determined by its corresponding control register settings. if you only want to transmit, receive data can be kept dummy. otherwise, if you only want to receive, you should transmit dummy '1' data. there are 4 i/o pin signals associated with spi transfers: sck (spiclk0,1), miso (spimiso0,1) data line, mosi (spimosi0,1) data line and active low /ss (nss0,1) pin (input). features ? support 2 -ch spi ? spi protocol (ver. 2.11) compatible ? 8-bit shift register for transmit ? 8-bit shift register for receive ? 8-bit prescaler logic ? polling, interrupt and dma transfer mode
spi S3C2440a risc m icroprocessor 22- 2 block diagram 8bit prescaler 1 pclk status register 1 prescaler register 1 /ss nss 0 sck spiclk 0 mosi spimosi 0 miso spimiso 0 pin control logic 0 mstr tx 8bit shift reg 0 rx 8bit shift reg 0 lsb msb lsb msb 8 8 clock spi clock (master) cpol cpha clock logic 0 mulf dcol redy apb i/f 0 (int dma 0) master slave slave master slave slave master data bus int 0 / int 1 req0 / req1 ack0 / ack1 /ss nss 1 sck spiclk 1 mosi spimosi 1 miso spimiso 1 pin control logic 1 mstr tx 8bit shift reg 1 rx 8bit shift reg 1 lsb msb lsb msb 8 8 clock spi clock (master) cpol cpha clock logic 1 mulf dcol redy apb i/f 1 (int dma 1) master slave slave master slave slave master int 0 / int 1 req0 / req1 ack0 / ack1 8bit prescaler 0 pclk status register 0 prescaler register 0 figure 22-1. spi block diagram
S3C2440a risc microprocessor spi 22- 3 spi operation using the spi interface, S3C2440a can send/receive 8-bit data simultaneously with an external device. a serial clock line is synchronized with the two data lines for shifting and sampling of the information. when the spi is the master, transmission frequency can be controlled by setting the appropriate bit in sppren register. you can modify its frequency to adjust the baud rate data register value. when the spi is a slave, other master supplies the clock. when the programmer writes byte data to sptdatn register, spi transmit/receive operation will start simultaneously. in some cases, nss should be activated before writing byte data to sptdatn. programming procedure when a byte data is written into the sptdatn register, spi starts to transmit if ensck and mstr of spconn register are set. you can use a typical programming procedure to operate an spi card. to program the spi modules, follow these basic steps: 1. set baud rate prescaler register (sppren). 2. set spconn to configure properly the spi module. 3. write data 0xff to sptdatn 10 times in order to initialize mmc or sd card. 4. set a gpio pin, which acts as nss, low to activate the mmc or sd card. 5. tx data ? check the status of transfer ready flag (redy=1), and then wr ite data to sptdatn. 6. rx data(1): spconn's tagd bit disable = normal mode 7. ? write 0xff to sptdatn, then confirm redy to set, and then read data from read buffer. 8. rx data(2): spconn's tagd bit enable = tx auto garbage data mode 9. ? confirm redy to set, and then read data from read buffer (then automatically start to transfer). 10. set a gpio pin, which acts as nss, high to deactivate the mmc or sd card.
spi S3C2440a risc m icroprocessor 22- 4 spi transfer format the S3C2440a supports 4 different formats to transfer data. figure 22-2 shows the four waveforms for spiclk. * l sb of previously transmitted character cycle mosi 1 2 3 4 5 6 7 8 msb 6 5 4 3 2 1 lsb 6 5 4 3 2 1 lsb spiclk miso msb cpol = 1, cpha = 1 (format b) * m sb of character just received cycle mosi 1 2 3 4 5 6 7 8 msb 6 5 4 3 2 1 lsb 6 5 4 3 2 1 lsb msb * spiclk miso msb cpol = 1, cpha = 0 (format a) cycle mosi 1 2 3 4 5 6 7 8 6 5 4 3 2 1 lsb 6 5 4 3 2 1 lsb * spiclk miso *lsb cpol = 0, cpha = 1 (format b) * m sb of character just received cycle mosi 1 2 3 4 5 6 7 8 msb 6 5 4 3 2 1 lsb 6 5 4 3 2 1 lsb msb * spiclk miso msb cpol = 0, cpha = 0 (format a) * l sb of previously transmitted character *lsb msb msb figure 22-2. spi transfer format
S3C2440a risc microprocessor spi 22- 5 transmitting procedure for dma 1. spi is configured as dma mode. 2. dma is configured properly. 3. spi requests dma service. 4. dma transmits 1byte data to the spi. 5. spi transmits the data to card. 6. return to step 3 until dma count becomes 0. 6. spi is configured as interrupt or polling mode with smod bits. receiving procedure for dma 1. spi is configured as dma start with smod bits and tagd bit set. 2. dma is configured properly. 3. spi receives 1byte data from card. 4. spi requests dma service. 5. dma receives the data from the spi. 6. write data 0xff automatically to sptdatn. 7. return to step 4 until dma count becomes 0. 8. spi is configured as polling mode with smod bits and clear tagd bit. 9. if spstan?s ready flag is set, then read the last byte data. note total received data = dma tc values + the last data in polling mode (step 9). the first dma received data is dummy and the user can neglect it.
spi S3C2440a risc m icroprocessor 22- 6 spi special registers spi control register register address r/w description reset value spcon0 0x59000000 r/w spi channel 0 control register 0x00 spcon1 0x59000020 r/w spi channel 1 control register 0x00 spconn bit description initial state spi mode select (smod) [6:5] determine how sptdat is read/written 00 = polling mode 01 = interrupt mode 10 = dma mode 11 = reserved 00 sck enable (ensck) [4] determine whether you want sck enabled or not (master only). 0 = disable 1 = enable 0 master/slave select (mstr) [3] determine the desired mode (master or slave). 0 = slave 1 = master note: in slave mode, there should be set up time for master to initiate tx/rx. 0 clock polarity select (cpol) [2] determine an active high or active low clock. 0 = active high 1 = active low 0 clock phase select (cpha) [1] select one of the two fundamentally different transfer format 0 = format a 1 = format b 0 tx auto garbage data mode enable (tagd) [0] decide whether the receiving data is required or not. 0 = normal mode 1 = tx auto garbage data mode note: in normal mode, if you only want to receive data, you should transmit dummy 0xff data. 0
S3C2440a risc microprocessor spi 22- 7 spi status register register address r/w description reset value spsta0 0x59000004 r spi channel 0 status register 0x01 spsta1 0x59000024 r spi channel 1 status register 0x01 spstan bit description initial state reserved [7:3] ? ? data collision error flag (dcol) [2] this flag is set if the sptdatn is written or sprdatn is read while a transfer is in progress and cleared by reading the spstan. 0 = not detect 1 = collision error detect 0 multi master error flag (mulf) [1] this flag is set if the nss signal goes to active low while the spi is configured as a master, and sppinn's enmul bit is multi master error detect mode. mulf is cleared by reading spstan. 0 = not detect 1 = multi master error detect 0 transfer ready flag (redy) [0] this bit indicates that sptdatn or sprdatn is ready to transmit or receive. this flag is automatically cleared by writing data to sptdatn. 0 = not ready 1 = data tx/rx ready 1
spi S3C2440a risc m icroprocessor 22- 8 spi pin control register when the spi system is enabled, the direction of pins except nss pin is controlled by mstr bit of spconn register. the direction of nss pin is always input. when the spi is a master, nss pin is used to check multi-master error, provided that the sppin's enmul bit is active, and another gpio should be used to select a slave. if the spi is configured as a slave, the nss pin is used to select spi as a slave by one master. register address r/w description reset value sppin0 0x59000008 r/w spi channel 0 pin control register 0x00 sppin1 0x59000028 r/w spi channel 1 pin control register 0x00 sppinn bit description initial state reserved [7:3] multi master error detect enable (enmul) [2] the nss pin is used as an input to detect multi master error when the spi system is a master. 0 = disable (general purpose) 1 = multi master error detect enable 0 reserved [1] reserved 0 master out keep (keep) [0] determine mosi drive or release when 1byte transmit is completed (master only). 0 = release 1 = drive the previous level 0 the spimiso (miso) and spimosi (mosi) data pins are used for transmitting and receiving serial data. when spi is configured as a master, spimiso (miso) is the master data input line, spimosi (mosi) is the master data output line, and spiclk (sck) is the clock output line. when spi becomes a slave, these pins perform reverse roles. in a multiple-master system, spiclk (sck) pins, spimosi (mosi) pins, and spimiso (miso) pins are tied to configure a group respectively. a master spi can experience a multi master error, when other spi device working as a master selects the S3C2440a spi as a slave. when this error is detected, the following actions are taken immediately. but you must previously set sppinn?s enmul bit if you want to detect this error. 1. the spconn's mstr bit is forced to 0 to operate in slave mode. 2. the spstan's mulf flag is set, and an spi interrupt is generated.
S3C2440a risc microprocessor spi 22- 9 spi baud rate prescaler register register address r/w description reset value sppre0 0x5900000c r/w spi cannel 0 baud rate prescaler register 0x00 sppre1 0x5900002c r/w spi cannel 1 baud rate prescaler register 0x00 sppren bit description initial state prescaler value [7:0] determine spi clock rate. baud rate = pclk / 2 / (prescaler value + 1) 0x00 note: baud rate should be less than 25 mhz. spi tx data register register address r/w description reset value sptdat0 0x59000010 r/w spi channel 0 tx data register 0x00 sptdat1 0x59000030 r/w spi channel 1 tx data register 0x00 sptdatn bit description initial state tx data register [7:0] this field contains the data to be transmitted over the spi channel. 0x00 spi rx data register register address r/w description reset value sprdat0 0x59000014 r spi channel 0 rx data register 0xff sprdat1 0x59000034 r spi channel 1 rx data register 0xff sprdatn bit description initial state rx data register [7:0] this field contains the data to be received over the spi channel. 0xff
spi S3C2440a risc m icroprocessor 22- 10 notes
S3C2440a risc microprocessor camera int erface 23 - 1 23 camera interface overview this chapter will explain the specification and defines the camera interface. camif (camera interface ) within the S3C2440a consists of 7 parts ? pattern mux, capturing unit, preview scaler, codec scaler, preview dma, codec dma , and sfr . the camif supports itu-r bt.601/656 ycbcr 8-bit standard. maximum input size is 4096x4096 pixels (2048x2048 pixels for scaling) and two scalers exist. preview scaler is dedicated to generate smaller size image like pip (picture in picture) and codec scaler is dedicated to generate codec useful image like plane type ycbcr 4:2:0 or 4:2:2. two master dmas can do mirror and rotate the captured image for mobile environments. these features are very useful in folder type cellular phones and the test pattern generated can be useful in calibration of input sync signals as camhref, camvsync. also, video sync signals and pixel clock polarity can be inverted in the camif side by using register setting. features ? itu-r bt. 601/656 8-bit mode external interface support ? dzi (digital zoom in) capability ? programmable polarity of video sync signals ? max. 4096 x 4096 pixel input support without scaling (2048 x 2048 pixel input support with scaling) ? max. 4096 x 4096 pixel output support for codec path ? max. 640 x 480 pixel output support for preview path ? image mirror and rotation (x-axis mirror, y-axis mirror, and 180 rotation) ? pip and codec input image generation (rgb 16/24-bit format and ycbcr 4:2:0/4:2:2 format) signal description table 23-1. camera interface signal description name i/o active description campclk i ? pixel clock, driven by the camera processor camvsync i h/l frame sync, driven by the camera processor camhref i h/l horizontal sync, driven by the camera processor camdata[7:0] i ? pixel data driven by the camera processor camclkout o ? master clock to the camera processor camreset o h/l software reset or power down to the camera processor note: i/o direction is on the ap side. i: input, o: output
S3C2440a risc microprocessor camera interface 23- 2 block diagram ycbcr 4:2:2 t_patternmux catchcam ycbcr 4:2:x preview scaler & rgb formatter codec scaler preview dma itu-r bt 601/656 codec dma cami f sfr ahb bus figure 23-1. camif overview
S3C2440a risc microprocessor camera int erface 23- 3 timing diagram camvsync y cb y cr y cb y cb y cr camhref camhref (1h) campclk camdata [7:0] vertical lines horizontal width 1 frame 8-bit mode figure 23-2. itu-r bt 601 input timing diagram campclk camdata [7:0] cr ff 00 00 xy cb y ff 00 00 xy video timing reference codes pixel data video timing reference codes figure 23-3. itu-r bt 656 input timing diagram there are two timing reference signals in itu-r bt 656 format, one is at the beginning of each video data block (start of active video, sav) and other is at the end of each video data block (end of active video, eav) as shown in figure 23-3 and table 23-2.
S3C2440a risc microprocessor camera interface 23- 4 table 23-2. video timing reference codes of itu-656 format data bit number first word second word third word fourth word 9 (msb) 1 0 0 1 8 1 0 0 f 7 1 0 0 v 6 1 0 0 h 5 1 0 0 p3 4 1 0 0 p2 3 1 0 0 p1 2 1 0 0 p0 1 (note) 1 0 0 0 0 1 0 0 0 for compatibility with existing 8-bit interfaces, the values of bits d1 and d0 are not defined. f = 0 (during field 1), 1 (during field 2) v = 0 (elsewhere), 1 (during field blanking) h = 0 (in sav: start of active video), 1 (in eav: end of active video) p0, p1, p2, p3 = protection bit camera interface logic can catch the video sync bits like h (sav, eav) and v (frame sync) after reserved data as ?ff-00-00?. note: all external camera interface ios are recommended to be schmitt-trigger type io for noise reduction.
S3C2440a risc microprocessor camera int erface 23- 5 camera interface operation two dma paths camif has 2 dma paths. p-path (preview path) and c-path (codec path) are separated from each other on the ahb bus. in view of the system bus, both the paths are independent. the p-path stores the rgb image data into memory for pip. the c-path stores the ycbcr 4:2:0 or 4:2:2 image data into memory for codec as mpeg-4, h.263, etc. these two master paths support the variable applications like dsc (digital steel camera), mpeg-4 video conference, video recording, etc. for example, p-path image can be used as preview image, and c-path image can be used as jpeg image in dsc application. register setting can separately disable to p-path or c-path. camif external camera processor frame memory (sdram) p-port c-port itu format pip rgb codec image ycbcr 4:2:0 or ycbcr 4:2:2 window cut camif external camera processor frame memory (sdram) p-port c-port itu format pip rgb codec image ycbcr 4:2:0 or ycbcr 4:2:2 figure 23-4. two dma paths clock domain camif has two clock domains. one is the system bus clock, which is hclk . the other is the pixel clock, which is campclk . the system clock must be faster than pixel clock . figure 23-5 shows camclkout must be divided from the fixed frequency like usb pll clock. if external clock oscillator is used, camclkout should be floated. internal scaler clock is system clock. it is not necessary for two clock domains to synchronize each other. other signals such as campclk should be similarly connected to the schmitt-triggered level shifter.
S3C2440a risc microprocessor camera interface 23- 6 frame memory hirerarchy frame memories consist of four ping-pong memories for each of p and c paths as shown in the figure 23-6. c- path ping-pong memories have three element memories ? luminance y, chrominance cb, and chrominance cr. if ahb-bus traffic is not enough for the dma operation to complete during one horizontal line period, it may lead to mal- functioning camclkout divide counter 1/1 ~ 1/16 upll external camera processor campclk S3C2440a camif usb pll 96 mhz f usb /d f usb mpll variable freq. divide counter f mpll /d f mpll hclk a external mclk normally use schmit- triggered level-shifter figure 23-5. camif clock generation
S3C2440a risc microprocessor camera int erface 23- 7 c-port y 1 c-port cb 1 c-port cr 1 c-port y 2 c-port cb 2 c-port cr 2 c-port y 3 c-port cb 3 c-port cr 3 c-port y 4 c-port cb 4 c-port cr 4 p-port rgb 1 p-port rgb 2 p-port rgb 3 p-port rgb 4 4-pingpong frame memory (sdram) itu-601/656 ycbcr 4:2:2 8-bits camera interface ahb bus & memorycontroller p-port rgb 4:4:4 c-port 4:2:0,2 figure 23-6. ping-pong memory hierarchy
S3C2440a risc microprocessor camera interface 23- 8 memory storing method the little-endian method in codec path is used to store in the frame memory. the pixels are stored from lsb to msb side. ahb bus carries 32-bit word data. so, camif makes each of the y-cb-cr words in little-endian style. for preview path, two different formats exist. one pixel (color 1 pixel) is one word for rgb 24-bit format. otherwise, two pixels are one word for rgb 16-bit format. please refer the following figure. camera interface y frame memory pclk data itu-601/656 ycbcr 4:2:2 8-bit input timing cb frame memory cr frame memory little endian method time y1 cb1 y2 cr1 y3 cb2 y4 cr2 y4 y3 y2 y1 y8 y7 y6 y5 cb4 cb3 cb2 cb1 cb8 cb7 cb6 cb5 little endian method cr4 cr3 cr2 cr1 cr8 cr7 cr6 cr5 little endian method rgb frame memory (24-bit) rgb1 rgb2 rgb3 rgb4 rgb5 rgb6 rgb7 rgb8 rgb frame memory (16-bit) rgb2/1 rgb4/3 rgb6/5 rgb8/7 rgb10/9 rgb12/11 rgb14/13 rgb16/15 32-bit r g b 2 32-bit 1 r 5 g 6 b 5 16-bit figure 23-7. memory storing style
S3C2440a risc microprocessor camera int erface 23- 9 timing diagram for register setting the first register setting for frame capture command can occur anywhere in the frame period. but, it is recommended that you set it at the camvsync ?l? state first and the camvsync information can be read from the status sfr (please see next page). all command include imgcpten, is valid at camvsync falling edge. but be careful that except for first sfr setting, all command should be programmed in an isr (interrupt service routine). especially, capture operation should be disabled when related information for target size are changed. camvsync camhref interrupt sfr setting (imgcpten) multi frame capturing reserved image capture < frame capture start > camvsync camhref interrupt new sfr command in isr in capturing reserved image capture < new command valid timing diagram > new command figure 23-8. timing diagram for register setting note: fifo overflow of codec path will be occurred if codec path is not operating when preview path is operated. if you want to use codec path under this case, you should stop preview path and reset camif using swrst bit of cigctrl register. then clear overflow of codec path and set special function registers that you want.
S3C2440a risc microprocessor camera interface 23- 10 timing diagram for last irq irq except lastirq is generated before image capturing. last irq which means capture-end can be set by following timing diagram. lastirqen is auto-cleared and ,as mentioned, sfr setting in isr is for next frame command. so, for adequate last irq, you should follow next sequence between lastirqen and imgcpten /imgcpten_cosc /imgcptenprsc. it is recommended that imgcpten /imgcpten_cosc /imgcptenprsc are set at same time and at last of sfr setting in isr. framecnt which is read in isr, means next frame count. on following diagram, last captured frame count is ?1?. that is, frame 1 is the last-captured frame among frame 0~3. framecnt is increased by 1 at irq rising. isr region isr region isr region vsync isr region imgcpten(cmd) lastirqen capture o capture o capture o capture x irq auto cleared last irq isr region isr region isr region framecnt capture o capture o (frame_3) (frame_0) (frame_1) (frame_3) (frame_0) 0 1 2 3 3 0 1 figure 23-9. timing diagram for last irq
S3C2440a risc microprocessor camera int erface 23- 11 camera interface special registers source format register register address r/w description reset value cisrcfmt 0x4f000000 rw input source format register 0 cisrcfmt bit description initial state itu601_656n [31] 0 = itu-r bt.656 ycbcr 8-bit mode enable 1 = itu-r bt.601 ycbcr 8-bit mode enable 0 uvoffset [30] cb,cr value offset control. 0 = +0 (normally used) - for ycbcr 1 = +128 - for yuv 0 reserved [29] this bit is reserved and the value must be 0. 0 sourcehsize [28:16] source horizontal pixel number (must be multiple of 8) 0 order422 [15:14] input ycbcr order inform for input 8-bit mode 00 = ycbycr 01 = ycrycb 10 = cbycry 11 = crycby 0 sourcevsize [12:0] source vertical pixel number 0 note: we recommend a following sequence for preventing fifo overflow at first frame of capture operation in codec path 1. cisrcfmt[31] <- '1' 2. s/w reset 3. initialize the camera i/f 4. start capturing 1. cisrcfmt[31] <- '1' 2. s/w reset 3. initialize the camera i/f 4. cisrcfmt[31] <- ' 0' //for itu 656 format 6. start capturing 7. clear overflow of codec on first isr
S3C2440a risc microprocessor camera interface 23- 12 window option register register address r/w description reset value ciwdofst 0x4f000004 rw window offset register 0 ciwdofst bit description initial state winofsen [31] 0 = no offset 1 = window offset enable 0 clrovcofiy [30] 0 = normal 1 = clear the overflow indication flag of input codec fifo y 0 winhorofst [26:16] window horizontal offset (the number which is the horizontal pixels except winhorofst * 2, must be multiple of 8) * winhorofst >= (sourcehsize-640*prehorratio_pr)/2 0 clrovcoficb [15] 0 = normal 1 = clear the overflow indication flag of input codec fifo cb 0 clrovcoficr [14] 0 = normal 1 = clear the overflow indication flag of input codec fifo cr 0 clrovprficb [13] 0 = normal 1 = clear the overflow indication flag of input preview fifo cb 0 clrovprficr [12] 0 = normal 1 = clear the overflow indication flag of input preview fifo cr 0 winverofst [10:0] window vertical offset 0 note: we recommend you to clear all the overflow bits before starting the capture operation. sourcehsize sourcevsize original input window cut : winhorofst : winverofst targethsize_xx targethsize_xx = targethsize_co or targethsize_pr targetvsize_xx figure 23-10. window offset scheme
S3C2440a risc microprocessor camera int erface 23- 13 global control register register address r/w description reset value cigctrl 0x4f000008 rw global control register 0 cigctrl bit description initial state swrst [31] camera interface software reset 0 camrst [30] external camera processor reset or power down 0 reserved [29] this bit is reserved and the value must be 1. 1 testpattern [28:27] this register should be set only at itu-t 601 8-bit mode. it is not allowed with itu-t 656 mode. (max. 1280 x 1024) 00 = external camera processor input (normal) 01 = color bar test pattern 10 = horizontal increment test pattern 11 = vertical increment test pattern 0 invpolcampclk [26] 0 = normal 1 = inverse the polarity of campclk 0 invpolcamvsync [25] 0 = normal 1 = inverse the polarity of camvsync 0 invpolcamhref [24] 0 = normal 1 = inverse the polarity of camhref 0 y1 start address register register address r/w description reset value cicoysa1 0x4f000018 rw y 1 st frame start address for codec dma 0 cicoysa1 bit description initial state cicoysa1 [31:0] y 1 st frame start address for codec dma 0 note: address of buffers must be multiple of 1024. y2 start address register register address r/w description reset value cicoysa2 0x4f00001c rw y 2 nd frame start address for codec dma 0 cicoysa2 bit description initial state cicoysa2 [31:0] y 2 nd frame start address for codec dma 0
S3C2440a risc microprocessor camera interface 23- 14 y3 start address register register address r/w description reset value cicoysa3 0x4f000020 rw y 3 nd frame start address for codec dma 0 cicoysa3 bit description initial state cicoysa3 [31:0] y 3 nd frame start address for codec dma 0 y4 start address register register address r/w description reset value cicoysa4 0x4f000024 rw y 4 th frame start address for codec dma 0 cicoysa4 bit description initial state cicoysa4 [31:0] y 4 th frame start address for codec dma 0 cb1 start address register register address r/w description reset value cicocbsa1 0x4f000028 rw cb 1 st frame start address for codec dma 0 cicocbsa1 bit description initial state cicocbsa1 [31:0] cb 1 st frame start address for codec dma 0 cb2 start address register register address r/w description reset value cicocbsa2 0x4f00002c rw cb 2 nd frame start address for codec dma 0 cicocbsa2 bit description initial state cicocbsa2 [31:0] cb 2 nd frame start address for codec dma 0
S3C2440a risc microprocessor camera int erface 23- 15 cb3 start address register register address r/w description reset value cicocbsa3 0x4f000030 rw cb 3 nd frame start address for codec dma 0 cicocbsa3 bit description initial state cicocbsa3 [31:0] cb 3 nd frame start address for codec dma 0 cb4 start address register register address r/w description reset value cicocbsa4 0x4f000034 rw cb 4 th frame start address for codec dma 0 cicocbsa4 bit description initial state cicocbsa4 [31:0] cb 4 th frame start address for codec dma 0 cr1 start address register register address r/w description reset value cicocrsa1 0x4f000038 rw cr 1 st frame start address for codec dma 0 cicocrsa1 bit description initial state cicocrsa1 [31:0] cr 1 st frame start address for codec dma 0 cr2 start address register register address r/w description reset value cicocrsa2 0x4f00003c rw cr 2 nd frame start address for codec dma 0 cicocrsa2 bit description initial state cicocrsa2 [31:0] cr 2 nd frame start address for codec dma 0
S3C2440a risc microprocessor camera interface 23- 16 cr3 start address register register address r/w description reset value cicocrsa3 0x4f000040 rw cr 3 nd frame start address for codec dma 0 cicocrsa3 bit description initial state cicocrsa3 [31:0] cr 3 nd frame start address for codec dma 0 cr4 start address register register address r/w description reset value cicocrsa4 0x4f000044 rw cr 4 th frame start address for codec dma 0 cicocrsa4 bit description initial state cicocrsa4 [31:0] cr 4 th frame start address for codec dma 0
S3C2440a risc microprocessor camera int erface 23- 17 codec target format register register address r/w description reset value cicotrgfmt 0x4f000048 rw target image format of codec dma 0 cicotrgfmt bit description initial state in422_co [31] 0 = ycbcr 4:2:0 codec scaler input image format. in this case, horizontal line decimation is performed before codec scaler. (normally used) 1 = ycbcr 4:2:2 codec scaler input image format. 0 out422_co [30] 0 = ycbcr 4:2:0 codec scaler output image format. this mode is mainly for mpeg-4 codec & h/w jpeg dct (normally used) 1 = ycbcr 4:2:2 codec scaler output image format. this mode is mainly for s/w jpeg. 0 targethsize_co [28:16] horizontal pixel number of target image for codec dma (multiple of 16) 0 flipmd_co [15:14] image mirror and rotation for codec dma 00 = normal 01 = x-axis mirror 10 = y-axis mirror 11 = 180 rotation 0 targetvsize_co [12:0] vertical pixel number of target image for codec dma 0
S3C2440a risc microprocessor camera interface 23- 18 original image x-axis flip y-axis flip 180 rotation figure 23-11. image mirror and rotation
S3C2440a risc microprocessor camera int erface 23- 19 codec dma control register register address r/w description reset value cicoctrl 0x4f00004c rw codec dma control related 0 cicoctrl bit description initial state yburst1_co [23:19] main burst length for codec y frames 0 yburst2_co [18:14] remained burst length for codec y frames 0 cburst1_co [13:9] main burst length for codec cb/cr frames 0 cburst2_co [8:4] remained burst length for codec cb/cr frames 0 lastirqen_co [2] 0 = normal 1 = enable last irq at the end of the frame capture (this bit is cleared automatically) 0 note: all burst lengths must be one of the 2, 4, 8, 16. example 1: target image size: qcif (horizontal y width = 176 pixels. 1 pixel = 1 byte. 1 word = 4 pixel) 176 / 4 = 44 word 44 % 8 = 4 ? main burst = 8, remained burst = 4 example 2: target image size: vga (horizontal y width = 640 pixels. 1 pixel = 1 byte. 1 word = 4 pixel) 640 / 4 = 160 word 160 % 16 = 0 ? main burst = 16, remained burst = 16 example 3: target image size: qcif (horizontal c width = 88 pixels. 1 pixel = 1 byte. 1 word = 4 pixel) 88 / 4 = 22 word 22 % 4 = 2 ? main burst = 4, remained burst = 2 (htrans==incr)
S3C2440a risc microprocessor camera interface 23- 20 register setting guide for codec scaler and preview scaler src_width and dst_width satisfy the word boundary constraints such that the number of horizontal pixel can be represented to kn where n = 1,2,3, ? and k = 1 / 2 / 8 for 24bpprgb / 16bpprgb / ycbcr420 image, respectively. targethsize should not be larger than sourcehsize. similarly, targetvsize should not be larger than sourcevsize. sourcehsize sourcevsize targethsize_xx targetvsize_xx original input scale down sourcehsize sourcevsize original input zoom in : winhorofst : winverofst targethsize_xx targetvsize_xx src_width = sourcehsize src_height = sourcevsize targethsize_xx = targethsize_co or targethsize_pr dst_width = targethsize_xx dst_height = targetvsize_xx targethsize_xx = targethsize_co or targethsize_pr dst_width = targethsize_xx dst_height = targetvsize_xx src_width = sourcehsize - (2 x winhorofst) src_height = sourcevsize - (2 x winverofst) figure 23-12. scaling scheme the other control registers of pre-scaled like image size, pre-scale ratio, pre-scale shift ratio and main scale ratio are defined according to the following equations. if ( src_width >= 64 dst_width ) { exit(-1); /* out of horizontal scale range */ } else if (src_width >= 32 dst_width) { prehorratio_xx = 32; h_shift = 5; } else if (src_width >= 16 dst_width) { prehorratio_xx = 16; h_shift = 4; } else if (src_width >= 8 dst_width) { prehorratio_xx = 8; h_shift = 3; } else if (src_width >= 4 dst_width) { prehorratio_xx = 4; h_shift = 2; } else if (src_width >= 2 dst_width) { prehorratio_xx = 2; h_shift = 1; } else { prehorratio_xx = 1; h_shift = 0; } predstwidth_xx = src_width / prehorratio_xx; mainhorratio_xx = ( src_width << 8 ) / ( dst_width << h_shift);
S3C2440a risc microprocessor camera int erface 23- 21 if ( src_height >= 64 dst_height ) { exit(-1); /* out of vertical scale range */ } else if (src_height >= 32 dst_height) { preverratio_xx = 32; v_shift = 5; } else if (src_height >= 16 dst_height) { preverratio_xx = 16; v_shift = 4; } else if (src_height >= 8 dst_height) { preverratio_xx = 8; v_shift = 3; } else if (src_height >= 4 dst_height) { preverratio_xx = 4; v_shift = 2; } else if (src_height >= 2 dst_height) { preverratio_xx = 2; v_shift = 1; } else { preverratio_xx = 1; v_shift = 0; } predstheight_xx = src_height / preverratio_xx; mainverratio_xx = ( src_height << 8 ) / ( dst_height << v_shift); s hfactor_xx = 10 ? ( h_shit + v_shift); note preview path contains 640 pixel line buffer. (codec path contains 2048 pixel line buffer) so, upper 1280 pixels, input images must be pre-scaled by over 1/2 for capturing valid preview image. ((sourcehsize- 2*winhorofst)/prehorratio_pr) <= 640 codec pre-scaler control register 1 register address r/w description reset value cicoscpreratio 0x4f000050 rw codec pre-scaler ratio control 0 cicoscpreratio bit description initial state shfactor_co [31:28] shift factor for codec pre-scaler 0 prehorratio_co [22:16] horizontal ratio of codec pre-scaler 0 preverratio_co [6:0] vertical ratio of codec pre-scaler 0 codec pre-scaler control register 2 register address r/w description reset value cicoscpredst 0x4f000054 rw codec pre-scaler destination format 0 cicoscpredst bit description initial state predstwidth_co [27:16] destination width for codec pre-scaler 0 predstheight_co [11:0] destination height for codec pre-scaler 0
S3C2440a risc microprocessor camera interface 23- 22 codec main-scaler control register register address r/w description reset value cicoscctrl 0x4f000058 rw codec main-scaler control 0 cicoscctrl bit description initial state scalerbypass_co [31] codec scaler bypass for upper 2048 x 2048 size (in this case, imgcpten_cosc and imgcpten_prsc should be 0, but imgcpten should be 1. it is not allowed to capture preview image. this mode is intended to capture jpeg input image for dsc application) in this case, input pixel buffering depends on only input fifos, so the system bus should be not busy in this mode. 0 scaleupdown_co [30:29] scale up/down flag for codec scaler (in 1:1 scale ratio, this bit should be ?1?) 00 = down 11 = up 00 mainhorratio_co [24:16] horizontal scale ratio for codec main-scaler 0 coscalerstart [15] codec scaler start 0 mainverratio_co [8:0] vertical scale ratio for codec main-scaler 0 codec dma target area register register address r/w description reset value cicotarea 0x4f00005c rw codec scaler target area 0 cicotarea bit description initial state cicotarea [25:0] target area for codec dma = target h size x target v size 0
S3C2440a risc microprocessor camera int erface 23- 23 codec status register register address r/w description reset value cicostatus 0x4f000064 r codec path status 0 cicostatus bit description initial state ovfiy_co [31] overflow state of codec source fifo y 0 ovficb_co [30] overflow state of codec source fifo cb 0 ovficr_co [29] overflow state of codec source fifo cr 0 vsync [28] camera vsync (this bit can be referred by cpu for first sfr setting. and, it can be seen in the itu-r bt 656 mode, too) 0 framecnt_co [27:26] frame count of codec dma (this counter value indicates the next frame number) 0 winofsten_co [25] window offset enable status 0 flipmd_co [24:23] flip mode of codec dma 0 imgcpten_camif [22] image capture enable of camera interface 0 imgcpten_cosc [21] image capture enable of codec path 0 rgb1 start address register register address r/w description reset value ciprclrsa1 0x4f00006c rw rgb 1 st frame start address for preview dma 0 ciprclrsa1 bit description initial state ciprclrsa1 [31:0] rgb 1 st frame start address for preview dma 0 rgb2 start address register register address r/w description reset value ciprclrsa2 0x4f000070 rw rgb 2 nd frame start address for preview dma 0 ciprclrsa2 bit description initial state ciprclrsa2 [31:0] rgb 2 nd frame start address for preview dma 0
S3C2440a risc microprocessor camera interface 23- 24 rgb3 start address register register address r/w description reset value ciprclrsa3 0x4f000074 rw rgb 3 nd frame start address for preview dma 0 ciprclrsa3 bit description initial state ciprclrsa3 [31:0] rgb 3 nd frame start address for preview dma 0 rgb4 start address register register address r/w description reset value ciprclrsa4 0x4f000078 rw rgb 4 th frame start address for preview dma 0 ciprclrsa4 bit description initial state ciprclrsa4 [31:0] rgb 4 th frame start address for preview dma 0 preview target format register register address r/w description reset value ciprtrgfmt 0x4f00007c rw target image format of preview dma 0 ciprtrgfmt bit description initial state targethsize_pr [28:16] horizontal pixel number of target image for preview dma (even) 0 flipmd_pr [15:14] image mirror and rotation for preview dma 00 = normal 01 = x-axis mirror 10 = y-axis mirror 11 = 180 rotation 0 targetvsize_pr [12:0] vertical pixel number of target image for preview dma 0
S3C2440a risc microprocessor camera int erface 23- 25 preview dma control register register address r/w description reset value ciprctrl 0x4f000080 rw preview dma control related 0 ciprctrl bit description initial state rgbburst1_pr [23:19] main burst length for preview rgb frames 0 rgbburst2_pr [18:14] remained burst length for preview rgb frames 0 lastirqen_pr [2] 0 = normal 1 = enable last irq at the end of frame capture. (this bit is cleared automatically.) 0 note: all burst lengths must be one of the 2, 4, 8, 16. example 1: target image size: qcif for rgb 32-bit format (horizontal width = 176 pixels. 1 pixel = 1 word) 176 pixel = 176 word. 176 % 16 = 0 ? main burst = 16, remained burst = 16 example 2 : target image size: vga for rgb 16-bit format (horizontal width = 640 pixels. 2 pixel = 1 word) 640 / 2 = 320 word 160 % 16 = 0 ? main burst = 16, remained burst = 16 preview pre-scaler control register 1 register address r/w description reset value ciprscpreratio 0x4f000084 rw preview pre-scaler ratio control 0 ciprscpreratio bit description initial state shfactor_pr [31:28] shift factor for preview pre-scaler 0 prehorratio_pr [22:16] horizontal ratio of preview pre-scaler 0 preverratio_pr [6:0] vertical ratio of preview pre-scaler 0
S3C2440a risc microprocessor camera interface 23- 26 preview pre-scaler control register 2 register address r/w description reset value ciprscpredst 0x4f000088 rw preview pre-scaler destination format 0 ciprscpredst bit description initial state predstwidth_pr [27:16] destination width for preview pre-scaler 0 predstheight_pr [11:0] destination height for preview pre-scaler 0 preview main-scaler control register register address r/w description reset value ciprscctrl 0x4f00008c rw preview main-scaler control 0 cicoscctrl bit description initial state sample_pr [31] sampling method for format conversion. (this bit is recommended to fix 1) 0 rgbformat_pr [30] 0 = 16-bit rgb 1 = 24-bit rgb 0 scaleupdown_pr [29:28] scale up/down flag for preview scaler (in 1:1 scale ratio, this bit should be ?1?) 00 = down 11 = up 00 mainhorratio_pr [24:16] horizontal scale ratio for preview main-scaler 0 prscalerstart [15] preview scaler start 0 mainverratio_pr [8:0] vertical scale ratio for preview main-scaler 0 preview dma target area register register address r/w description reset value ciprtarea 0x4f000090 rw preview scaler target area 0 ciprtarea bit description initial state ciprtarea [25:0] target area for preview dma = target h size x target v size 0
S3C2440a risc microprocessor camera int erface 23- 27 preview status register register address r/w description reset value ciprstatus 0x4f000098 r preview path status 0 ciprstatus bit description initial state ovficb_pr [31] overflow state of preview source fifo cb 0 ovficr_pr [30] overflow state of preview source fifo cr 0 framecnt_pr [27:26] frame count of preview dma 0 flipmd_pr [24:23] flip mode of preview dma 0 imgcpten_prsc [21] image capture enable of preview path 0 image capture enable register this register must be set at last. register address r/w description reset value ciimgcpt 0x4f0000a0 rw image capture enable command 0 cigctrl bit description initial state imgcpten [31] camera interface global capture enable 0 imgcpten_cosc [30] capture enable for codec scaler. this bit must be ?0? in scaler bypass mode. 0 imgcpten_prsc [29] capture enable for preview scaler this bit must be ?0? in scaler bypass mode. 0
S3C2440a risc microprocessor camera interface 23- 28 notes
S3C2440a risc microprocessor ac97 controller 24- 1 24 ac97 controller overview the ac97 controller unit of the S3C2440a supports ac97 revision 2.0 features. ac97 controller communicates with ac97 codec using an audio controller link (ac-link). controller sends the stereo pcm data to codec. the external digital-to-analog converter (dac) in the codec then converts the audio sample to an analog audio waveform. also, the controller receives the stereo pcm data and the mono mic data from the codec and then stores them in the memories. this chapter describes the programming model for the ac97 controller unit. the information in this chapter requires an understanding of the ac97 revision 2.0 specifications. note the ac97 controller and the i 2 s controller must not be used at the same time. features ? independent c hannels for stereo pcm in, stereo pcm out, mono mic in. ? dma-based operation and interrupt based operation. ? all of the channels support only 16-bit samples. ? variable sampling rate ac97 codec interface (48 khz and below) ? 16-bit, 16 entry fifos per channel ? only primary codec support
ac97 controller S3C2440a risc microprocessor 24- 2 ac97 controller operation block diagram figure 24-1 shows the functional block diagram of the S3C2440a ac97 controller. the ac97 signals form the ac- link, which is a point-to-point synchronous serial interconnect that supports full-duplex data transfers. all digital audio streams and command/status information are communicated over the ac-link. apb i/f dma engine interrupt control mic in fifo pcm out fifo pcm in fifo sfr ac-link i/f fsm & control apb ac-link figure 24-1. ac97 block diagram
S3C2440a risc microprocessor ac97 controller 24- 3 internal data path figure 24-2 shows the internal data path of the S3C2440a ac97 controller. it has stereo pulse code modulated (pcm) in, stereo pcm out and mono mic-in buffers, which consist of 16-bit, 16 entries buffer. also it has a 20-bit i/o shift register via ac-link. command addr register command data register pcm out buffer (regfile 16 bit x 2 x 16 entry) pwdata response data register mic in buffer (regfile 16 bit x16 entry) pcm in buffer (regfile 16 bit x 2 x 16 entry) prdata input shift register (20 bit) output shift register (20 bit) sdata_in sdata_out figure 24-2. internal data path
ac97 controller S3C2440a risc microprocessor 24- 4 operation flow chart system reset or cold reset set gpio and release intmsk/subintmsk bits enable codec ready interrupt disable codec ready interrupt dma operation or pio (interrupt or polling) operation controller off yes no no codec ready interrupt ? time out condition ? figure 24-3. ac97 operation flow chart
S3C2440a risc microprocessor ac97 controller 24- 5 ac-link digital interface protocol each ac97 codec incorporates a five-pin digital serial interface that links it to the S3C2440a ac97 controller. the ac-link is a full-duplex, fixed-clock, pcm digital stream. it employs a time division multiplexing (tdm) scheme to handle control register access and multiple input and output audio streams. the ac-link architecture divides each audio frame into 12 outgoing and 12 incoming data streams. each stream has a 20-bit sample resolution and requires a dac and an analog-to-digital converter (adc) with a minimum of 16-bit resolution. sync sdata_out sdata_in slot # tag cmd addr cmd data pcm pcm rsrvd tag status addr status data pcm left pcm right 0 1 2 3 4 5 6 7 8 9 10 11 12 rsrvd rsrvd rsrvd rsrvd rsrvd rsrvd rsrvd rsrvd rsrvd rsrvd rsrvd rsrvd rsrvd rsrvd pcm mic left right figure 24-4. bi-directional ac-link frame with slot assignments figure 24-4 shows the slot definitions supported by the S3C2440a ac97 controller. the S3C2440a ac97 controller provides synchronization for all data transaction on the ac-link. a data transaction is made up of 256-bits of information broken up into groups of 13 time slots and is called a frame. time slot 0 is called as tag phase and it is 16-bits long. the remaining 12 time slots are called as data phase. the tag phase contains a bit that identifies a valid frame and 12-bits that identify the time slots in the data phase that contain a valid data. each time slot in the data phase is 20-bits long. a frame begins when the sync goes high. the amount of time the sync is high corresponds to the tag phase. ac97 frames occur at fixed 48 khz intervals and are synchronous to the 12.288 mhz bit rate clock, bitclk. the controller and the codec use the sync and bitclk to determine when to send the transmit data and when to sample the received data. a transmitter transitions the serial data stream on each rising edge of bitclk and a receiver samples the serial data stream on falling edges of bitclk. the transmitter must tag the valid slots in its serial data stream. the valid slots are tagged in slot 0. serial data on the ac-link is from msb to lsb. the tag phase?s first bit is bit 15 and the first bit of each slot in the data phase is bit 19. the last bit in any slot is bit 0.
ac97 controller S3C2440a risc microprocessor 24- 6 ac-link output frame (sdata_out) sdata_out bit_clk sync ac '97 samples sync assertion here ac '97 controller samples first sdata_out bit of frame here end of previous audio frame valid frame slot(1) slot(2) slot(12) "0" id1 id0 19 0 tag phase data phase 19 0 start of data phase slot# 1 end of data frame slot# 12 48khz 12.288mhz figure 24-5. ac-link output frame ac-link input frame (sdata_in) sdata_out bit_clk sync ac '97 samples sync assertion here ac '97 controller samples first sdata_in bit of frame here end of previous audio frame codec ready slot(1) slot(2) slot(12) "0" "0" "0" 19 0 tag phase data phase 19 0 start of data phase slot# 1 end of data frame slot# 12 figure 24-6. ac-link input frame
S3C2440a risc microprocessor ac97 controller 24- 7 ac97 powerdown sdata_out sdata_in bit_clk sync slot 12 prev.frame write to 0x26 slot 12 prev.frame tag tag data pr4 figure 24-7. ac97 powerdown timing diagram powering down the ac-link the ac-link signals enter a low power mode when the ac97 codec powerdown register (0x26) bit pr4 is set to 1 (i.e. by writing 0x1000). then the primary codec drives both the bitclk and sdata_in to a logic low voltage level. the sequence follows the timing diagram shown above in the figure 24-7. the ac97 controller transmits the write to powerdown register (0x26) over the ac-link. set up the ac97 controller so that it does not transmit data to slots 3-12 when it writes to the powerdown register bit pr4 (data 0x1000), and it does not require the codec to process other data when it receives a power down request. when the codec processes the request, it immediately transitions bitclk and sdata_in to a logic low level. the ac97 controller drives the sync and sdata_out to a logic low level after programming the ac_glbctrl register.
ac97 controller S3C2440a risc microprocessor 24- 8 waking up the ac-link - wake up triggered by the ac97 controller ac-link protocol is provided for a cold ac97 reset and a warm ac97 reset. the current power-down state ultimately dictates which ac97 reset is used. registers must stay in the same state during all power-down modes unless a cold ac97 reset is performed. in a cold ac97 reset, the ac97 registers are initialized to their default values. after a power down, the ac-link must wait for a minimum of four audio frame time after the frame in which the power down occurred before it can be reactivated by reasserting the sync signal. when ac-link powers up, it indicates readiness through the codec ready bit (input slot 0, bit 15). analog off pr2 or pr3 digital i/f off pr4 shut off ac-link dacs off pr1 adcs off pr0 normal default ready = 1 pr0 = 0 & adc = 1 pr1 = 0 & adc = 1 pr2 = 0 & anl = 1 warm reset cold reset pr0 = 1 pr1 = 1 pr2 = 1 pr4 = 1 figure 24-8. ac97 power down/power up flow cold ac97 reset a cold reset is generated when an nreset pin is asserted through the ac_glbctrl. asserting and de-asserting nreset activates the bitclk and sdata_out. all the ac97 control registers are initialized to their default power on reset values. nreset is an asynchronous ac97 input. warm ac97 reset a warm ac97 reset reactivates the ac-link without altering the current ac97 register values. a warm reset is generated when bitclk is absent and sync is driven high. in normal audio frames, sync is a synchronous ac97 input. when bitclk is absent, sync is treated as an asynchronous input used to generate a warm reset to ac97.the ac97 controller must not activate bitclk until it samples the sync to low again. this prevents a new audio frame from being falsely detected.
S3C2440a risc microprocessor ac97 controller 24- 9 ac97 controller special registers ac97 global control register (ac_glbctrl) register address r/w description reset value ac_glbctrl 0x5b000000 r/w ac97 global control register 0x000000 ac_glbctrl bit description initial state reserved [31:23] ? 0x00 codec ready interrupt enable [22] 0: disable 1: enable 0 pcm out channel underrun interrupt enable [21] 0: disable 1: enable (fifo is empty) 0 pcm in channel overrun interrupt enable [20] 0 : disable 1 : enable (fifo is full) 0 mic in channel overrun interrupt enable [19] 0: disable 1: enable (fifo is full) 0 pcm out channel threshold interrupt enable [18] 0: disable 1: enable (fifo is half empty) 0 pcm in channel threshold interrupt enable [17] 0: disable 1: enable (fifo is half full) 0 mic in channel threshold interrupt enable [16] 0: disable 1: enable (fifo is half full) 0 reserved [15:14] ? 00 pcm out channel transfer mode [13:12] 00: off 01: pio 10: dma 11: reserved 00 pcm in channel transfer mode [11:10] 00: off 01: pio 10: dma 11: reserved 00 mic in channel transfer mode [9:8] 00: off 01: pio 10: dma 11: reserved 00 reserved [7:4] ? 0000 transfer data enable using ac- link [3] 0: disable 1: enable 0 ac-link on [2] 0: off 1: sync signal transfer to codec 0 warm reset [1] 0: normal 1: wake up codec from power down 0 cold reset [0] 0: normal 1: reset codec and controller logic 0
ac97 controller S3C2440a risc microprocessor 24- 10 ac97 global status register (ac_glbstat) register address r/w description reset value ac_glbstat 0x5b000004 r ac97 global status register 0x00000000 ac_glbstat bit description initial state reserved [31:23] ? 0x00 codec ready interrupt [22] 0: not requested 1: requested 0 pcm out channel underrun interrupt [21] 0: not requested 1: requested 0 pcm in channel overrun interrupt [20] 0: not requested 1: requested 0 mic in channel overrun interrupt [19] 0: not requested 1: requested 0 pcm out channel threshold interrupt [18] 0: not requested 1: requested 0 pcm in channel threshold interrupt [17] 0: not requested 1: requested 0 mic in channel threshold interrupt [16] 0: not requested 1: requested 0 reserved [15:3] ? 0x000 controller main state [2:0] 000: idle 001: init 010: ready 011: active 100: lp 101: warm 000 ac97 codec command register (ac_codec_cmd) register address r/w description reset value ac_codec_cmd 0x5b000008 r/w ac97 codec command register 0x00000000 ac_codec_cmd bit description initial state reserved [31:24] ? 0x00 read enable [23] 0: command write (note) 1: status read 0 address [22:16] codec command address 0x00 data [15:0] codec command data 0x0000 note: when the commands are written on the ac_coddec_cmd register, it is recommended that the delay time between the command and the next command is more than 1/48 hz.
S3C2440a risc microprocessor ac97 controller 24- 11 ac97 codec status register (ac_codec_stat) register address r/w description reset value ac_codec_stat 0x5b00000c r ac97 codec status register 0x00000000 ac_codec_stat bit description initial state reserved [31:23] ? 0x00 address [22:16] codec status address 0x00 data [15:0] codec status data 0x0000 ntoes: if you want to read data from ac97 codec register via the ac_codec_stat register, you should follow these steps. 1. write command address and data on the ac_codec_cmd register with bit [23] =1. 2. have a delay time. 3. read command address and data from ac_codec_stat register. ac97 pcm out/in channel fifo address register (ac_pcmaddr) register address r/w description reset value ac_pcmaddr 0x5b000010 r ac97 pcm out/in channel fifo address register 0x00000000 ac_pcmaddr bit description initial state reserved [31:28] ? 0000 out read address [27:24] pcm out channel fifo read address 0000 reserved [23:20] ? 0000 in read address [19:16] pcm in channel fifo read address 0000 reserved [15:12] ? 0000 out write address [11:8] pcm out channel fifo write address 0000 reserved [7:4] ? 0000 in write address [3:0] pcm in channel fifo write address 0000
ac97 controller S3C2440a risc microprocessor 24- 12 ac97 mic in channel fifo address register (ac_micaddr) register address r/w description reset value ac_micaddr 0x5b000014 r ac97 mic in channel fifo address register 0x00000000 ac_micaddr bit description initial state reserved [31:20] ? 0000 read address [19:16] mic in channel fifo read address 0000 reserved [15:4] ? 0x000 write address [3:0] mic in channel fifo write address 0000 ac97 pcm out/in channel fifo data register (ac_pcmdata) register address r/w description reset value ac_pcmdata 0x5b000018 r/w ac97 pcm out/in channel fifo data register 0x00000000 ac_pcmdata bit description initial state left data [31:16] pcm out/in left channel fifo data read: pcm in left channel write: pcm out left channel 0x0000 right data [15:0] pcm out/in right channel fifo data read: pcm in right channel write: pcm out right channel 0x0000 ac97 mic in channel fifo data register (ac_micdata) register address r/w description reset value ac_micdata 0x5b00001c r/w ac97 mic in channel fifo data register 0x00000000 ac_micdata bit description initial state reserved [31:16] ? 0x0000 mono data [15:0] mic in mono channel fifo data 0x0000
S3C2440a risc microprocessor bus priorities 25- 1 25 bus priorities overview the bus arbitration logic determines the priorities of bus masters. it supports a combination of rotation priority mode and fixed priority mode. bus priority map the S3C2440a holds 13 bus masters. they include dram refresh controller, lcd_dma, camif dma, dma0, dma1, dma2, dma3, usb_host_dma, ext_bus_master, test interface controller (tic) and arm920t. the following list shows the priorities among these bus masters after a reset: 1. dram refresh controller 2. lcd_dma 3. camif codec dma 4. camif preview dma 5. dma0 6. dma1 7. dma2 8. dma3 9. usb host dma 10. external bus master 11. tic 12. arm920t 13. reserved among these bus masters, the four dmas (dma0, dma1, dma2 and dma3) operate under rotation priority, while the others run under fixed priority.
bus priorities s3c 2440a risc microprocessor 25- 2 notes
S3C2440a risc microprocessor mechanical data 26- 1 26 mechanical data package dimensions 14.00 14.00 0.35 + 0.05 1.22 289-fbga-1414 0.45 0.05 c 0.12 max 0.10 c a b 0.15 tolerance 0.10 x 2 0.15 x 2 c c samsung figure 26-1. 289-fbga-1414 package dimension 1 (top view)
mechanical data S3C2440a risc microprocessor 26- 2 a1 index mark 0.80 x 16 = 12.80 0.05 14.00 0.80 0.80 a b c d e f g h j k l m n p r t u 8 9 10 11 12 13 14 15 16 17 5 6 7 1 2 3 4 14.00 0.15 0.08 m m c c a b 289 - 0.45 0.05 tolerance 0.10 figure 26-2. 289-fbga-1414 package dimension 2 (bottom view) the recommended land open size is 0.39 ? 0.41mm diameter.
S3C2440a risc microprocessor electrica l data 27- 1 27 electrical data absolute maximum ratings table 27-1. absolute maximum rating parameter symbol rating unit dc supply voltage v ddi 1.2v v dd 1.8 v v ddop 3.3v v dd 4.8 v ddmop 1.8v/2.5v/3.0v/3.3v v dd 4.8 v ddrtc 1.8v/2.5v/3.0v/3.3v v dd 4.5 v ddadc 3.3v v dd 4.8 dc input voltage v in 3.3v input buffer 4.8 3.3v interface / 5v tolerant input buffer 6.5 dc output voltage v out 3.3v output buffer 4.8 dc input (latch-up) current i in 200 ma storage temperature t stg ? 65 to 150 o c
electrical data s 3c2440a risc microprocessor 27- 2 recommended operating conditions table 27-2. recommended operating conditions parameter symbol rating unit typ. min max dc supply voltage for alive block v ddalive 300mhz: 1.2v v dd 400mhz: 1.3v v dd 1.15 1.15 1.25 1.35 v dc supply voltage for internal v ddi (1) v ddiarm (1) v ddmpll v ddupll 300mhz: 1.2v v dd 400mhz: 1.3v v dd 1.15 1.25 1.25 1.35 dc supply voltage for i/o block v ddop 3.3v v dd 3.0 3.6 dc supply voltage for memory interface v ddmop 1.8v/2.5v/3.0v/3.3v v dd 1.7 3.6 dc supply voltage for analog core v dd 3.3v v dd 3.0 3.6 dc supply voltage for rtc v ddrtc 1.8v/2.5v/3.0v/3.3v v dd 1.8 3.6 dc input voltage v in 3.3v input buffer ? 0.3 v ddop +0.3 3.3v interface / 5v tolerant input buffer ? 0.3 5.25 dc output voltage v out 3.3v output buffer ? 0.3 v ddop +0.3 operating temperature t opr industrial ?40 to 85 o c note: in the dvs(dynamic voltage scaling) vddi & vddiarm can be supplied with 1.0v in idle mode. refer the application notes for detailed information.
S3C2440a risc microprocessor electrica l data 27- 3 d.c. electrical characteristics table 27-3 and 27-4 defines the dc electrical characteristics for the standard lvcmos i/o buffers. table 27-3. normal i/o pad dc electrical characteristics normal i/o pad dc electrical characteristics for memory (v ddmop = 2.5v 0.2v, t a = ?40 to 85 c) symbol parameters condition min typ. max unit v ih high level input voltage v lvcmos interface 1.7 v il low level input voltage v lvcmos interface 0.7 vt switching threshold 0.5v dd v vt+ schmitt trigger, positive-going threshold cmos 2.0 v vt? schmitt trigger, negative-going threshold cmos 0.8 v i ih high level input current a input buffer v in = v dd ?10 10 i il low level input current a input buffer v in = v ss ?10 10 input buffer with pull-up ?60 ?33 ?10 v oh high level output voltage v type b4 to b12 i oh = ? 1 a v dd ?0.05 type b4 i oh = ? 4 ma 2.0 type b6 i oh = ? 6 ma type b8 i oh = ? 8 ma type b10 i oh = ? 10 ma type b12 i oh = ? 12ma v ol low level output voltage v type b4 to b12 i ol = 1 a 0.05 type b4 i ol = 4 ma 0.4 type b6 i ol = 6 ma type b8 i ol = 8 ma type b10 i ol = 10 ma type b12 i ol = 12 ma notes: 1. type b6 means 6ma output driver cell. 2. type b8 means 8ma output driver cell.
electrical data s 3c2440a risc microprocessor 27- 4 normal i/o pad dc electrical characteristics for memory (v ddmop =3.0v 0.3v, 3.3v 0.3v, t a = ?40 to 85 c) symbol parameters condition min typ. max unit v ih high level input voltage v lvcmos interface 2.0 v il low level input voltage v lvcmos interface 0.8 vt switching threshold 0.5v dd v vt+ schmitt trigger, positive-going threshold cmos 2.0 v vt? schmitt trigger, negative-going threshold cmos 0.8 v i ih high level input current a input buffer v in = v dd ?10 10 i il low level input current a input buffer v in = v ss ?10 10 input buffer with pull-up ?60 ?33 ?10 v oh high level output voltage v type b4 to b12 i oh = ? 1 a v dd ?0.05 type b4 i oh = ? 4 ma 2.4 type b6 i oh = ? 6 ma type b8 i oh = ? 8 ma type b10 i oh = ?10 ma type b12 i oh = ?12 ma v ol low level output voltage v type b4 to b12 i ol = 1 a 0.05 type b4 i ol = 4 ma 0.4 type b6 i ol = 6 ma type b8 i ol = 8 ma type b10 i ol = 10 ma type b12 i ol = 12 ma notes: 1. type b6 means 6ma output driver cell. 2. type b8 means 8ma output driver cell. 3. type b12 means 12ma output driver cells.
S3C2440a risc microprocessor electrica l data 27- 5 normal i/o pad dc electrical characteristics for i/o (v ddop = 3.3v 0.3v, t a = ?40 to 85 c) symbol parameters condition min typ. max unit v ih high level input voltage v lvcmos interface 2.0 v il low level input voltage v lvcmos interface 0.8 vt switching threshold 0.5v dd v vt+ schmitt trigger, positive-going threshold cmos 2.0 v vt? schmitt trigger, negative-going threshold cmos 0.8 v i ih high level input current a input buffer v in = v dd ?10 10 i il low level input current a input buffer v in = v ss ?10 10 input buffer with pull-up ?60 ?33 ?10 v oh high level output voltage v type b4 to b12 i oh = ? 1 a v dd ? 0.05 type b4 i oh = ? 4 ma 2.4 type b6 i oh = ? 6 ma type b8 i oh = ? 8 ma type b10 i oh = ?10 ma type b12 i oh = ?12 ma v ol low level output voltage v type b4 to b12 i ol = 1 a 0.05 type b4 i ol = 4 ma 0.4 type b6 i ol = 6 ma type b8 i ol = 8 ma type b10 i ol = 10 ma type b12 i ol = 12 ma notes: 1. type b6 means 6ma output driver cell. 2. type b8 means 8ma output driver cell. 3. type b12 means 12ma output driver cells.
electrical data s 3c2440a risc microprocessor 27- 6 table 27-4. usb dc electrical characteristics symbol parameter condition min max unit v ih high level input voltage ? 2.5 ? v v il low level input voltage ? ? 0.8 v i ih high level input current vin = 3.3v ?10 10 a i il low level input current vin = 0.0v ?10 10 a v oh static output high 15k to gnd 2.8 3.6 v v ol static output low 1.5k to 3.6v 0.3 v table 27-5. S3C2440 power supply voltage and current parameter value unit condition typical v ddi / v ddop 1.3 / 3.3 v without dvs max. operating frequency (fclk) 400 mhz ? max. operating frequency (hclk) 133 mhz ? max. operating frequency (pclk) 67 mhz ? typical normal mode power (3) (total v ddi + v io ) 368 mw (1) typical normal mode power (3) (total v ddi + vio) 310 mw (2) typical idle mode power (3) (total v ddi + v io ) 213 mw fclk = 400mhz (f:h:p = 1:3:6) typical slow mode power (3) (total v ddi + v io ) 97 mw fclk = 12mhz (f:h:p = 1:1:1) typical sleep mode power (3) 380 a @1.2/3.3v, room temperature all other i/o static. typical rtc power (3) 3 a @3.0v, room temperature x-tal = 32.768khz for rtc notes: 1. i/d cache: on, mmu: on, code on sram, fclk:hclk:pclk = 400mhz:133mhz:66.7mhz :lcd on (320x240x16bppx60hz, color tft):13 khz timer internal mode (5 channel run) :audio (iis&dma, cdclk=16.9mhz, lrck=44.1khz):integer data quick sort (65536 ea) 2. pocket pc 2003 mpeg play 3. the above power consumption data is measured in room temperature with random sample (lot #: kzz1fs).
S3C2440a risc microprocessor electrica l data 27- 7 400mhz power consumption 87mw 88mw 139mw 68mw 0 50 100 150 200 250 without dvs with dvs item [mw] core power 51% down total power 32% down vdd_core vdd_io figure 27-1. power consumption example comparison when applied dvs scheme note: (condition) current measure condition: play battlife.wma(bit rate=64kbps) on ppc2003 smdk2440. core power: without dvs : vddiarm/vddi/vddupll/vddmpll/vddalive = 1.3v using dvs : vddiarm/vddi = 1.3v 1.0v, vddupll/vddmpll/vddalive = 1.3v i/o power : vddop/vddmop/vddrtc/vddadc=3.3v refer the application notes for more information about dvs. table 27-6. typical c urrent d ecrease by clkcon r egister fclk:hclk:pclk = 300:100:50mhz, 1.2v (random sample) (unit: ma) peripherals nfc lcd usbh usbd timer sdi uart rtc adc iic iis spi camera total current 1.7 2.8 0.37 0.79 0.32 1.0 2.7 0.45 0.26 0.32 0.78 0.16 14.25 26.26 note: this table includes power consumption of each peripheral. for example, if you do not use camera and have turned off the camera block by clkcon register, then you can save the 14.25ma of internal block.
electrical data s 3c2440a risc microprocessor 27- 8 a.c. electrical characteristics 1/2 v dd 1/2 v dd t xtalcyc note: clock input is from the x tipll pin. figure 27-2. xtipll clock timing diagram t exthigh v ih 1/2 v dd v il v il v ih v ih 1/2 v dd t extlow t extcyc note: clock input is from the extclk pin. figure 27-3. extclk clock input timing diagram hclk (internal) extclk t ex2hc figure 27-4. extclk/hclk in case when extclk is used without the pll
S3C2440a risc microprocessor electrica l data 27- 9 hclk (internal) sclk clkout (hclk) t hc2ck t hc2sclk figure 27-5. hclk/clkout/sclk in case when extclk is used extclk t resw nreset figure 27-6. manual reset input timing diagram
electrical data s 3c2440a risc microprocessor 27- 10 nreset xtipll or extclk vco output mcu operates by xtipll or extclk clcok. clock disable t pll fclk is new frequency. power pll can operate after om[3:2] is latched. pll is configured by s/w first time. vco is adapted to new clock frequency. fclk ... ... ... t rst2run figure 27-7. power-on oscillation setting timing diagram
S3C2440a risc microprocessor electrica l data 27- 11 xtipll vco output clock disable fclk several slow clocks (xtipll or extclk) power_off mode is initiated. t osc2 extclk figure 27-8. sleep mode return oscillation setting timing diagram
electrical data s 3c2440a risc microprocessor 27- 12 hclk ngcsx t rad noe data addr nbex t rcd t rod t rod t rcd tacc t rad t rad t rad t rad t rad t rad t rad t rad t rds t rdh t rds t rdh t rds t rdh t rds t rdh t rds t rdh t rds t rdh t rds t rdh t rds t rdh '1' figure 27-9. rom/sram burst read timing diagram (i) (tacs=0, tcos=0, tacc=2, toch=0, tcah=0, pmc=0, st=0, dw=16bit)
S3C2440a risc microprocessor electrica l data 27- 13 hclk ngcsx t rad noe data addr nbex t rcd t rod t rod t rcd t rbed t rbed tacc t rad t rad t rad t rad t rad t rad t rad t rad t rds t rdh t rds t rdh t rds t rdh t rds t rdh t rds t rdh t rds t rdh t rds t rdh t rds t rdh figure 27-10. rom/sram burst read timing diagram (ii) (tacs=0, tcos=0, tacc=2, toch=0, tcah=0, pmc=0, st=1, dw=16bit)
electrical data s 3c2440a risc microprocessor 27- 14 hclk ngs noe addr txnbrqs xnbreq txnbrqh xnback 'hz' 'hz' 'hz' txnbackd txnbackd thzd thzd thzd figure 27-11. external bus request in rom/sram cycle (tacs=0, tcos=0, tacc=8, toch=0, tcah=0, pmc=0, st=0)
S3C2440a risc microprocessor electrica l data 27- 15 hclk ngcsx t rad tacs noe tcos data addr nwbex '1' toch tcah t rcd t rod t rds t rdh t rod t rcd t rad tacc figure 27-12. rom/sram read timing diagram (i) (tacs=2, tcos=2, tacc=4, toch=2, tcah=2, pmc=0, st=0)
electrical data s 3c2440a risc microprocessor 27- 16 hclk ngcsx t rad tacs noe tcos data addr nbex toch tcah t rcd t rod t rds t rdh t rod t rcd t rad t rbed t rbed tacc figure 27-13. rom/sram read timing diagram (ii) (tacs=2, tcos=2, tacc=4, toch=2, tcah=2cycle, pmc=0, st=1)
S3C2440a risc microprocessor electrica l data 27- 17 hclk ngcsx t rad tacs nwe tcos data addr nwbex toch tcah t rcd t rwd t rdd t rwd t rcd t rad tcos toch t rwbed t rwbed tacc t rdd figure 27-14. rom/sram write timing diagram (i) (tacs=2,tcos=2,tacc=4,toch=2, tcah=2, pmc=0, st=0
electrical data s 3c2440a risc microprocessor 27- 18 hclk ngcsx t rad tacs nwe tcos data addr nbex toch tcah t rcd t rwd t rdd t rwd t rcd t rad t rbed t rbed tacc t rdd figure 27-15. rom/sram write timing diagram (ii) (tacs=2, tcos=2, tacc=4, toch=2, tcah=2, pmc=0, st=1)
S3C2440a risc microprocessor electrica l data 27- 19 hclk ngcsx noe tacc = 6cycle nwait data addr tacs tacs delayed t rc note : t he status of nwait is checked at (tacc-1) cycle. sampling nwait figure 27-16. external nwait read timing diagram (tacs=0, tcos=0, tacc=6, toch=0, tcah=0, pmc=0, st=0) hclk ngcsx nwe data addr t rdd t rdd tacc >= 2cycle nwait t ws t wh figure 27-17. external nwait write timing diagram (tacs=0, tcos=0, tacc=4, toch=0, tcah=0, pmc=0, st=0)
electrical data s 3c2440a risc microprocessor 27- 20 hclk ngcsx t rad tacs noe tcos data addr t rcd t rod t rds t rdh t rad tacc figure 27-18. masked-rom single read timing diagram (tacs=2, tcos=2, tacc=8, pmc=01/10/11) hclk ngcsx t rad noe data addr t rcd t rod t rds t rdh t rad tacc tpac tpac tpac tpac t rad t rad t rad t rad t rds t rdh t rds t rdh t rds t rdh t rds t rdh figure 27-19. masked-rom consecutive read timing diagram (tacs=0, tcos=0, tacc=3, tpac=2, pmc=01/10/11)
S3C2440a risc microprocessor electrica l data 27- 21 sclk nsras t sad trp nscas data addr/ba nbex t srd t sds t sdh scke a10/ap ngcsx t scsd nwe t sad t scd t swd '1' trcd t sbed tcl figure 27-20. sdram single burst read timing diagram (trp=2, trcd=2, tcl=2, dw=16bit)
electrical data s 3c2440a risc microprocessor 27- 22 sclk nsras nscas addr/ba nbex txnbrqh txnbrqs scke a10/ap ngcsx nwe '1' xnbreq xnback extclk txnbackd txnbackd 'hz' 'hz' 'hz' 'hz' 'hz' 'hz' 'hz' 'hz' 'hz' thzd thzd thzd thzd thzd thzd thzd thzd thzd txnbrql figure 27-21. external bus request in sdram timing diagram (trp=2, trcd=2, tcl=2)
S3C2440a risc microprocessor electrica l data 27- 23 sclk nsras t sad nscas data addr/ba nbex t srd scke a10/ap ngcsx t scsd nwe t sad t scd t swd '1' t sad t scsd t srd 'hz' '1' t swd figure 27-22. sdram mrs timing diagram
electrical data s 3c2440a risc microprocessor 27- 24 sclk nsras t sad trp nscas data addr/ba nbex t srd t sds t sdh scke a10/ap ngcsx t scsd nwe t sad t scd t swd '1' t sad t sad trcd t scsd t srd t scsd t sad t sad t sbed tcl figure 27-23. sdram single read timing diagram (i) (trp=2, trcd=2, tcl=2)
S3C2440a risc microprocessor electrica l data 27- 25 sclk nsras t sad trp nscas data addr/ba nbex t srd t sds t sdh scke a10/ap ngcsx t scsd nwe t sad t scd t swd '1' t sad t sad trcd t scsd t srd t scsd t sad t sad t sbed tcl figure 27-24. sdram single read timing diagram (ii) (trp=2, trcd=2, tcl=3)
electrical data s 3c2440a risc microprocessor 27- 26 sclk nsras t sad trp nscas data addr/ba nbex t srd scke a10/ap ngcsx t scsd nwe t sad t scd t swd '1' t sad t scsd t srd '1' '1' 'hz' trc note: before executing an auto/self refresh command, all the banks must be in idle state. figure 27-25. sdram auto refresh timing diagram (trp=2, trc=4)
S3C2440a risc microprocessor electrica l data 27- 27 sclk nsras t sad trp nscas data addr/ba nbex t srd t sds t sdh scke a10/ap ngcsx t scsd nwe t sad t scd t swd '1' trcd t sbed tcl tcl tcl figure 27-26. sdram page hit-miss read timing diagram (trp=2, trcd=2, tcl=2)
electrical data s 3c2440a risc microprocessor 27- 28 sclk nsras t sad trp nscas data addr/ba nbex t srd scke a10/ap ngcsx t scsd nwe t sad t scd t swd t sad t scsd t srd '1' '1' 'hz' trc t cked 'hz' '1' '1' '1' '1' '1' t cked note: before executing an auto/self refresh command, all the banks must be in idle state. figure 27-27. sdram self refresh timing diagram (trp=2, trc=4)
S3C2440a risc microprocessor electrica l data 27- 29 sclk nsras t sad trp nscas data addr/ba nbex t srd t sdd t sdd scke a10/ap ngcsx t scsd nwe t sad t scd t swd '1' t sad t sad trcd t scsd t srd t scsd t sad t sad t sbed t swd figure 27-28. sdram single write timing diagram (trp=2, trcd=2)
electrical data s 3c2440a risc microprocessor 27- 30 sclk nsras t sad trp nscas data addr/ba nbex t srd t sdd t sdd scke a10/ap ngcsx t scsd nwe t sad t scd t swd '1' trcd t sbed figure 27-29. sdram page hit-miss write timing diagram (trp=2, trcd=2, tcl=2)
S3C2440a risc microprocessor electrica l data 27- 31 xsclk t xrs t xrs t cadl t cadh t xad xnxdreq xnxdack read write min. 3sclk figure 27-30. external dma timing diagram (handshake, single transfer) vsync hsync vden tf2hsetup tf2hhold tvspw tvbpd tvfpd hsync vclk vd vden lend tl2csetup tvclkh tvclk tvclkl tvdhold tvdsetup tve2hold tle2chold tlewidth figure 27-31. tft lcd controller timing diagram
electrical data s 3c2440a risc microprocessor 27- 32 iissclk t lrck iislrck (out) t sdo iislrck (out) t sdih t sdis iissdi (in) figure 27-32. iis interface timing diagram t stoph t starts t sdas t sdah t buf t sclhigh t scllow f scl iicscl iicsda figure 27-33. iic interface timing diagram
S3C2440a risc microprocessor electrica l data 27- 33 sdclk t sdcd sdcmd (out) t sdch t sdcs t sddd sdcmd (in) t sddh t sdds sddata[3:0] (in) sddata[3:0] (out) figure 27-34. sd/mmc interface timing diagram spiclk t spimod t spisih t spisis t spisod t spimih t spimis spimosi (mo) spimosi (si) spimiso (so) spimiso (mi) figure 27-35. spi interface timing diagram (cpha=1, cpol=1)
electrical data s 3c2440a risc microprocessor 27- 34 t acls t wrph0 t wrph1 command t wrph0 t wrph1 address hclk ale nfwe data[7:0] data[7:0] hclk cle nfwe t cled t cled t wed t wed t wds t wdh t aled t wed t wds t aled t wed t wdh t acls figure 27-36. nand flash address/command timing diagram hclk nfwe t wrph0 t wrph1 data[7:0] hclk nfre t wrph0 t wrph1 data[7:0] t wed t wed t wdh t wed t wed t rds t rdh t wds wdata rdata figure 27-37. nand flash timing diagram
S3C2440a risc microprocessor electrica l data 27- 35 table 27-7. clock timing constants (v ddi, v ddalive, v ddiarm = 1.2 v 0.1 v, t a = ?40 to 85 c, v ddmop = 3.3v 0.3v) parameter symbol min typ max unit crystal clock input frequency f xtal 12 ? 20 mhz crystal clock input cycle time t xtalcyc 50 ? 83.3 ns external clock input frequency f ext ? ? 66 mhz external clock input cycle time t extcyc 15.0 ? ? ns external clock input low level pulse width t extlow 7 ? ? ns external clock to hclk (without pll) t ex2hc 3 ? 7 ns hclk (internal) to clkout t hc2ck 3 ? 9 ns hclk (internal) to sclk t hc2sclk 1 ? 2 ns external clock input high level pulse width t exthigh 4 ? ? ns reset assert time after clock stabilization t resw 4 ? ? xtipll or extclk pll lock time t pll 300 ? s sleep mode return oscillation setting time t osc2 ? ? 65536 xtipll or extclk interval before cpu runs after nreset is released t rst2run ? 7 ? xtipll or extclk
electrical data s 3c2440a risc microprocessor 27- 36 table 27-8. rom/sram bus timing constants (v ddi, v ddalive, v ddiarm = 1.2 v 0.1 v, t a = ?40 to 85 c, v ddmop = 3.3v 0.3v / 3.0v 0.3v / 2.5v 0.2v / 1.8v 0.1v) parameter symbol min (v ddmop = 3.3v/3.0v/2.5v/1.8v) typ max (v ddmop = 3.3v/3.0v/2.5v/1.8v) unit rom/sram address delay t rad 2 / 2 / 2 / 3 ? 6 / 6 / 7 / 8 ns rom/sram chip select delay t rcd 2 / 2 / 3 / 3 ? 6 / 6 / 6 / 7 ns rom/sram output enable delay t rod 2 / 2 / 2 / 3 ? 5 / 5 / 5 / 6 ns rom/sram read data setup time. t rds 1 / 1 / 1 / 2 ? ? / ? / ? / ? ns rom/sram read data hold time. t rdh 0 / 0 / 0 / 0 ? ? / ? / ? / ? ns rom/sram byte enable delay t rbed 2 / 2 / 2 / 3 ? 5 / 5 / 5 / 7 ns rom/sram write byte enable delay t rwbed 2 / 2 / 2 / 3 ? 5 / 5 / 6 / 7 ns rom/sram output data delay t rdd 2 / 2 / 2 / 2 ? 6 / 6 / 6 / 7 ns rom/sram external wait setup time t ws 3 / 3 / 4 / 4 ? ? / ? / ? / ? ns rom/sram external wait hold time t wh 0 / 0 / 0 / 0 ? ? / ? / ? / ? ns rom/sram write enable delay t rwd 2 / 2 / 2 / 3 ? 5 / 5 / 6 / 7 ns table 27-9. memory interface timing constants (v ddi, v ddalive, v ddiarm = 1.2 v 0.1 v, t a = ?40 to 85 c, v ddmop = 3.3v 0.3v / 3.0v 0.3v / 2.5v 0.2v / 1.8v 0.1v) parameter symbol min typ max unit sdram address delay t sad 1 ? 4 ns sdram chip select delay t scsd 1 ? 3 ns sdram row active delay t srd 1 ? 3 ns sdram column active delay t scd 1 ? 3 ns sdram byte enable delay t sbed 1 ? 3 ns sdram write enable delay t swd 1 ? 2 ns sdram read data setup time t sds 2 / 3 / 3 / 5 * ? ? ns sdram read data hold time t sdh 0 ? ? ns sdram output data delay t sdd 1 ? 4 ns sdram clock enable delay t cked 2 ? 3 ns note: minimum t sds = 2ns / 3ns / 3ns, when v ddmop = 3.3v / 3.0v / 2.5v / 1.8v respectively.
S3C2440a risc microprocessor electrica l data 27- 37 table 27-10. external bus request timing constants (v dd = 1.2 v 0.1 v, t a = ?40 to 85 c, v ext = 3.3v 0.3v) parameter symbol min typ. max unit external bus request setup time t xnbrqs 4 ? ? ns external bus request hold time t xnbrqh 1 ? ? ns external bus ack delay t xnbackd 4 ? 10 ns hz delay t hzd 2 ? 6 ns table 27-11. dma controller module signal timing constants (v dd = 1.2 v 0.1 v, t a = ?40 to 85 c, v ext = 3.3v 0.3v) parameter symbol min typ. max unit external request setup t xrs 5 ? ? ns access to ack delay during low transition t cadl 3 ? 8 ns access to ack delay during high transition t cadh 3 ? 8 ns external request delay t xad 2 ? ? sclk
electrical data s 3c2440a risc microprocessor 27- 38 table 27-12. tft lcd controller module signal timing constants (v dd = 1.2 v 0.05 v, t a = ?40 to 85 c, v ext = 3.3v 0.3v) parameter symbol min typ max units vertical sync pulse width tvspw vspw + 1 ? ? phclk (1) vertical back porch delay tvbpd vbpd+1 ? ? phclk vertical front porch delay tvfpd vfpd+1 ? ? phclk vclk pulse width tvclk 1 ? ? pvclk (2) vclk pulse width high tvclkh 0.5 ? ? pvclk vclk pulse width low tvclkl 0.5 ? ? pvclk hsync setup to vclk falling edge tl2csetup 0.5 ? ? pvclk vden setup to vclk falling edge tde2csetup 0.5 ? ? pvclk vden hold from vclk falling edge tde2chold 0.5 ? ? pvclk vd setup to vclk falling edge tvd2csetup 0.5 ? ? pvclk vd hold from vclk falling edge tvd2chold 0.5 ? ? pvclk vsync setup to hsync falling edge tf2hsetup hspw + 1 ? ? pvclk vsync hold from hsync falling edge tf2hhold hbpd + hfpd + hozval + 3 ? ? pvclk notes: 1. hsync period 2. vclk period table 27-13. iis controller module signal timing constants (v dd = 1.2 v 0.1 v, t a = ?40 to 85 c, v ext = 3.3v 0.3v) parameter symbol min typ. max unit iislrck delay time t lrck 0 ? 3 ns iisdo delay time t sdo 1 ? 2 ns iisdi input setup time t sdis 13 ? ? ns iisdi input hold time t sdih 1 ? ? ns codec clock frequency f codec 1/16 ? 1 f iis_block
S3C2440a risc microprocessor electrica l data 27- 39 table 27-14. iic bus controller module signal timing (v dd = 1.2 v 0.05 v, t a = ?40 to 85 c, v ext = 3.3v 0.3v) parameter symbol min typ. max unit scl clock frequency f scl ? ? std. 100 fast 400 khz scl high level pulse width t sclhigh std. 4.0 fast 0.6 ? ? m s scl low level pulse width t scllow std. 4.7 fast 1.3 ? ? m s bus free time between stop and start t buf std. 4.7 fast 1.3 ? ? m s start hold time t starts std. 4.0 fast 0.6 ? ? m s sda hold time t sdah std. 0 fast 0 ? std. ? fast 0.9 m s sda setup time t sdas std. 250 fast 100 ? ? ns stop setup time t stoph std. 4.0 fast 0.6 ? ? m s notes: std. means standard mode and fast means fast mode. 1. the iic data hold time (t sdah ) is minimum 0ns. (iic data hold time is minimum 0ns for standard/fast bus mode in iic specification v2.1) please check whether the data hold time of your iic device is 0 ns or not. 2. the iic control ler supports only iic bus device (standard/fast bus mode), and not c bus device. table 27-15. sd/mmc interface transmit/receive timing constants (v dd = 1.2 v 0.1 v, t a = ?40 to 85 c, v ext = 3.3v 0.3v) parameter symbol min typ. max unit sd command output delay time t sdcd 0 ? 1 ns sd command input setup time t sdcs 14 ? ? ns sd command input hold time t sdch 1 ? ? ns sd data output delay time t sddd 0 ? 1 ns sd data input setup time t sdds 13 ? ? ns sd data input hold time t sddh 1 ? ? ns
electrical data s 3c2440a risc microprocessor 27- 40 table 27-16. spi interface transmit/receive timing constants (v dd = 1.2 v 0.1 v, t a = ?40 to 85 c, v ext = 3.3v 0.3v) parameter symbol min typ. max unit spi mosi master output delay time t spimod 0 ? 1 ns spi mosi slave input setup time t spisis 1 ? ? ns spi mosi slave input hold time t spisih 1 ? ? ns spi miso slave output delay time t spisod 7 ? 17 ns spi miso master input setup time t spimis 15 ? ? ns spi miso master input hold time t spimih 1 ? ? ns table 27-17. usb electrical specifications (v dd = 1.2 v 0.05 v, t a = ?40 to 85 c, v ext = 3.3v 0.3v) parameter symbol condition min max unit supply current suspend device i ccs 10 a leakage current hi-z state input leakage i lo 0v < vin < 3.3v ?10 10 a input levels differential input sensitivity v di | (d+) ? (d?) | 0.2 v differential common mode range v cm includes v di range 0.8 2.5 single ended receiver threshold v se 0.8 2.0 output levels static output low v ol rl of 1.5k w to 3.6v 0.2 v static output high v oh rl of 15 k w to gnd 2.8 3.6 capacitance transceiver capacitance c in pin to gnd 20 pf
S3C2440a risc microprocessor electrica l data 27- 41 table 27-18. usb full speed output buffer electrical characteristics (v dd = 1.2 v 0.05 v, t a = ?40 to 85 c, v ext = 3.3v 0.3v) parameter symbol condition min max unit driver characteristics transition time rise time fall time tr tf cl = 50pf cl = 50pf 4.0 4.0 20 20 ns rise/fall time matching trfm (tr / tf ) 90 111.1 % output signal crossover voltage vcrs 1.3 2.0 v drive output resistance zdrv steady state drive 28 44 w table 27-19. usb low speed output buffer electrical characteristics (v dd = 1.2 v 0.05 v, t a = ?40 to 85 c, v ext = 3.3v 0.3v) parameter symbol condition min max unit driver characteristics rising time tr cl = 50pf cl = 350pf 75 ns 300 falling time tf cl = 50pf cl = 350pf 75 300 rise/fall time matching trfm (tr / tf ) 80 125 % output signal crossover voltage vcrs 1.3 2.0 v note: all measurement conditions are in accordance with the universal serial bus specification 1.1 final draft revision.
electrical data s 3c2440a risc microprocessor 27- 42 table 27-20. nand flash interface timing constants (v ddi, v ddalive, v ddiarm = 1.2 v 0.1 v, t a = ?40 to 85 c, v ddmop = 3.3v 0.3v / 3.0v 0.3v / 2.5v 0.2v / 1.8v 0.1v) parameter symbol min (v ddmop = 3.3v/3.0v/2.5v/1.8v) max (v ddmop = 3.3v/3.0v/2.5v/1.8v) unit nfcon chip enable delay t ced ? / ? / ? / ? 5.4/5.6/5.9/7.1 ns nfcon cle delay t cled ? / ? / ? / ? 5.3/5.5/5.8/7.0 ns nfcon ale delay t aled ? / ? / ? / ? 5.4/5.6/5.9/7.1 ns nfcon write enable delay t wed ? / ? / ? / ? 5.0/5.2/5.5/6.7 ns nfcon read enable delay t red ? / ? / ? / ? 5.0/5.2/5.5/6.7 ns nfcon write data setup time t wds 5.8/6.0/6.3/7.5 ? / ? / ? / ? ns nfcon write data hold time t wdh 4.6/4.8/5.1/6.3 ? / ? / ? / ? ns nfcon read data setup requirement time t rds 3/3.1/3.3/4 ? / ? / ? / ? ns nfcon read data hold requirement time t rdh 0.3/0.3/0.3/0.3 ? / ? / ? / ? ns


▲Up To Search▲   

 
Price & Availability of S3C2440

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X